edmundy added the comment:
Thanks a lot!
Kozyarchuk.
I have thought the self.myurl should be the object variable, not class
variable.
The class variable really is confusing.
Why do they like that?
--
status: open -> closed
___
Python tracker
Maksim Kozyarchuk 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 = []
...
New submission from edmundy :
The following is the test code.
class C1:
myurl = []
def test(self):
url = [5,6,7]
self.myurl.extend(url)
def testv():
c = C1()
c.test()
print(c.myurl)
i = 0
while i<10