Erik Max Francis
max at alcyone.com
Sat Aug 24 22:07:50 CEST 2002
"Mr. Neutron" wrote:
> Nope classes are not the same thing in memory.
> Somehow my variable is being shared between both objects.
Note that all "variables" in Python are really just bindings, and all
the assignment statement does is rebind names. So when you have
multiple bindings to the same mutable object, changes in one will affect
>>> a = [1, 2, 3]
>>> b = a
[1, 2, 3, 4]
If you want a separate copy, you will have to do so explicitly.
Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/
__ San Jose, CA, US / 37 20 N 121 53 W / ICQ16063900 / &tSftDotIotE
/ \ There is nothing so subject to the inconstancy of fortune as war.
\__/ Miguel de Cervantes
Church / http://www.alcyone.com/pyos/church/
A lambda calculus explorer in Python.
More information about the Python-list