edmundy yong.su...@163.com 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
___
New submission from edmundy yong.su...@163.com:
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)
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):
...