list/classmethod problems
Diez B. Roggisch
deets at nospam.web.de
Mon Mar 13 15:24:09 EST 2006
>
> Apparently, the p1 instance somehow thinks that the i3 instance is in
> its list. The i3 instance should instead be in the list for p2. By the
> way, when I call the __str__() method of p2, I get the same results as
> when I do it for p1. The list appears to be acting as if it were a
> static member - which it is not.
>
> I do have some @classmethod methods in these classes in my complete
> script. Would that confuse the interpreter into thinking that other
> members are also static?
>
> I can't seem to find any information on this problem. Does anyone have
> any ideas?
Read this:
http://www.python.org/doc/faq/general/#why-are-default-values-shared-between-objects
HTH,
Diez
More information about the Python-list
mailing list