Someone enlightened me

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Marcus Low

    Someone enlightened me

    Opps here is the mail again, incase my formatting is lost, can someone
    explain to me why this code behaves differently when "lister" and
    "self.liste r" is swap remarked.


    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()


Working...