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 Kozyarchuk
Recipients Kozyarchuk, Yong yang
Date 2009-03-31.14:56:31
SpamBayes Score 1.7474468e-06
Marked as misclassified No
Message-id <1238511393.98.0.265206065637.issue5620@psf.upfronthosting.co.za>
In-reply-to
Content
AFAIK, This is expected behavior.  myurl is a class attribute if you
want it to be different per instance you should re-initialize it in the
__init__ method.  See below. 

>>> class C1(object):
...     def __init__(self):
...             self.myurl = []
...     def test(self):
...             self.myurl.extend([5,6,7])
...
[44085 refs]
>>> def testv():
...     c = C1()
...     c.test()
...     print(c.myurl)
...
[44108 refs]
>>> for i in range(10):
...     testv()
...
[5, 6, 7]
[5, 6, 7]
[5, 6, 7]
[5, 6, 7]
[5, 6, 7]
[5, 6, 7]
[5, 6, 7]
[5, 6, 7]
[5, 6, 7]
[5, 6, 7]
[44119 refs]
History
Date User Action Args
2009-03-31 14:56:34Kozyarchuksetrecipients: + Kozyarchuk, Yong yang
2009-03-31 14:56:33Kozyarchuksetmessageid: <1238511393.98.0.265206065637.issue5620@psf.upfronthosting.co.za>
2009-03-31 14:56:32Kozyarchuklinkissue5620 messages
2009-03-31 14:56:31Kozyarchukcreate