Class Chaos
Maximilian Michel
michel at in.tum.de
Mon Jun 28 05:57:28 EDT 2004
Hallo everyone,
i hope someone can help me with this kind a interesting problem i have
in python 2.3:
my code looks like this:
class Read:
list = []
__init__(self):
self.list.append = ***data from file***
print(self):
print self.list
instantiating it one time works ok, assuming data from file = AAA:
...
a = Read()
AAA
but when i continue, instantiating more object of the Read class this
happens:
b = Read()
AAA
AAA
c = Read()
AAA
AAA
AAA
it's like the new instance always continues or reimports the data from
the former instance.
Or is it just a dumb mistake i keep making?
Thanks for your help,
max
More information about the Python-list
mailing list