Re: Class v. Instance variables in Python

2008-11-10 Thread Zane Selvans
Joe Strout strout.net> writes: > How are you creating your list? You need to make sure that each > instance creates its very own list object, something like: > >self.foo = [] > > rather than grabbing a reference to some shared list instance, such as > one defined as a default argument

Re: Class v. Instance variables in Python

2008-11-10 Thread Joe Strout
On Nov 10, 2008, at 2:44 PM, Zane Selvans wrote: However, one (and only one) of these instance variables is behaving mysteriously like a class variable: all instances of the class are sharing a single copy of the variable, located at the same place in memory. Is there a common mistake tha

Class v. Instance variables in Python

2008-11-10 Thread Zane Selvans
I have defined a class called Lineament, which has no class variables - only instance variables, defined and set within __init__(), and later potentially modified by other class methods. However, one (and only one) of these instance variables is behaving mysteriously like a class variable: