Someone enlightened me

Discussion in 'Python' started by Marcus Low, Jul 13, 2008.

  1. Marcus Low

    Marcus Low Guest

    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.lister" is swap remarked.


    class abc :
    # remark this later and unremark "self.lister"
    lister = []
    def __init__ (self, val):
    #self.lister = []
    self.lister.append(val)

    globallist = []


    def test () :

    global l
    for x in range(10) :
    o = abc(x)
    globallist.append(o)
    o = ""

    for i in globallist :
    print i.lister

    test()
     
    Marcus Low, Jul 13, 2008
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Toby Considine

    Re: I m gonna mad Plz someone help me

    Toby Considine, Aug 31, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    2,312
    Toby Considine
    Aug 31, 2003
  2. Richard Sloan

    Can someone tell me what this is doing

    Richard Sloan, Jan 8, 2006, in forum: Perl
    Replies:
    1
    Views:
    2,174
    Jon Phipps
    May 19, 2006
  3. Ian
    Replies:
    0
    Views:
    1,902
  4. Grocery Clerk

    need to be enlightened on pid_t

    Grocery Clerk, Oct 3, 2004, in forum: C Programming
    Replies:
    4
    Views:
    3,543
    Fredrik Tolf
    Oct 4, 2004
  5. Marcus Low

    Someone enlightened me

    Marcus Low, Jul 13, 2008, in forum: Python
    Replies:
    1
    Views:
    289
    bukzor
    Jul 13, 2008
Loading...

Share This Page