Maksim Kozyarchuk <maksim_kozyarc...@yahoo.com> added the comment:

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]

----------
nosy: +Kozyarchuk

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue5620>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to