Message84791
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] |
|
Date |
User |
Action |
Args |
2009-03-31 14:56:34 | Kozyarchuk | set | recipients:
+ Kozyarchuk, Yong yang |
2009-03-31 14:56:33 | Kozyarchuk | set | messageid: <1238511393.98.0.265206065637.issue5620@psf.upfronthosting.co.za> |
2009-03-31 14:56:32 | Kozyarchuk | link | issue5620 messages |
2009-03-31 14:56:31 | Kozyarchuk | create | |
|