Python instances

Roland Heiber newstonne at web.de
Wed Apr 20 03:38:55 EDT 2005


Hi,

> class MyClass:
>     list = []

you have "list" defined as a classmember, not an instancemember. So 
"list" ist defined ONCE for all instances.

Try this instead:

class MyClass:
     def __init__(self):
	self.list = []
[...]

and use self.list ...

HtH, Roland



More information about the Python-list mailing list