Can someone explain to me, why the behaviour below is different when u
remark "lister" and unremark "self.liste r"?
#--------------------------------------------------------------
class abc :
# remark this later and unremark "self.liste r"
lister = []
def __init__ (self, val):
#self.lister = []
self.lister.app end(val)
#--------------------------------------------------------------
globallist = []
#--------------------------------------------------------------
def test () :
global l
for x in range(10) :
o = abc(x)
globallist.appe nd(o)
o = ""
for i in globallist :
print i.lister
#--------------------------------------------------------------
test()
#--------------------------------------------------------------
remark "lister" and unremark "self.liste r"?
#--------------------------------------------------------------
class abc :
# remark this later and unremark "self.liste r"
lister = []
def __init__ (self, val):
#self.lister = []
self.lister.app end(val)
#--------------------------------------------------------------
globallist = []
#--------------------------------------------------------------
def test () :
global l
for x in range(10) :
o = abc(x)
globallist.appe nd(o)
o = ""
for i in globallist :
print i.lister
#--------------------------------------------------------------
test()
#--------------------------------------------------------------
Comment