homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author mattofak
Recipients mattofak
Date 2012年05月08日.16:48:00
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1336495681.08.0.928968758685.issue14756@psf.upfronthosting.co.za>
In-reply-to
Content
When initializing a class with an empty dict() object as a default initializer, if it is not overridden, multiple instances of the class will share the dictionary. IE:
class test(object):
 def __init__(self, obj=dict()):
 self.obj = obj
a = test()
b = test()
Then id(a.obj) points to the same location as id(b.obj). The behaviour I would expect would be that a.obj and b.obj would be unique instances.
History
Date User Action Args
2012年05月08日 16:48:01mattofaksetrecipients: + mattofak
2012年05月08日 16:48:01mattofaksetmessageid: <1336495681.08.0.928968758685.issue14756@psf.upfronthosting.co.za>
2012年05月08日 16:48:00mattofaklinkissue14756 messages
2012年05月08日 16:48:00mattofakcreate

AltStyle によって変換されたページ (->オリジナル) /