What's wrong?

Fuming Wang fuming at venus.radsci.uci.edu
Sun Oct 24 02:06:25 EDT 1999


Hi, following code snippet gave me a surpise. Could anyone tell me what's
wrong?

>>> class A:
...     def __init__(self, list=[]):
...          self._list = list
... 
>>> a = A()
>>> a._list
[]
>>> b = A()
>>> b._list
[]
>>> a == b
0
>>> a is b 
0
>>> a._list.append(4)
>>> a._list
[4]
>>> b._list
[4]
>>> 


Thanks!
Fuming Wang






More information about the Python-list mailing list