Re: Class v. Instance variables in Python

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Zane Selvans

    Re: Class v. Instance variables in Python

    Joe Strout <joe <atstrout.netwr ites:
    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 to your __init__ method.
    Ah! Yes, that's it. Gah, this has been driving me nuts all day. Thanks!


Working...