Author r.david.murray
Recipients awaltman, r.david.murray
Date 2009-12-10.02:42:21
SpamBayes Score 5.797e-06
Marked as misclassified No
Message-id <1260412943.67.0.945231731215.issue7465@psf.upfronthosting.co.za>
In-reply-to
Content
Yes, this working as intended.  Consider:

Python 2.7a1+ (trunk:76725, Dec  9 2009, 09:26:36)
[GCC 4.4.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> class baseClass(object):
...     def __init__(self, testList=[]):
...         self.testList = testList
...     def insertItem(self):
...         self.testList.append("testing from baseClass")
...
>>> a = baseClass()
>>> b = baseClass()
>>> del b
>>> a.insertItem()
>>> print a.testList
['testing from baseClass']
>>> b = baseClass()
>>> print b.testList
['testing from baseClass']


See
http://docs.python.org/faq/design.html#why-are-default-values-shared-between-objects
for an explanation of why.
History
Date User Action Args
2009-12-10 02:42:23r.david.murraysetrecipients: + r.david.murray, awaltman
2009-12-10 02:42:23r.david.murraysetmessageid: <1260412943.67.0.945231731215.issue7465@psf.upfronthosting.co.za>
2009-12-10 02:42:22r.david.murraylinkissue7465 messages
2009-12-10 02:42:21r.david.murraycreate