Re: Someone enlightened me

2008-07-12 Thread Marcus Low

Duh,

Ok here is the file again ...attached. I give up doing this via the 
email editor. Sorry! new to the mailing list.


Marcus

Marcus Low wrote:
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()  



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()
--
http://mail.python.org/mailman/listinfo/python-list

Someone enlightened me

2008-07-12 Thread Marcus Low
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()   



--
http://mail.python.org/mailman/listinfo/python-list


Someone enlightened me

2008-07-12 Thread Marcus Low
Can someone explain to me, why the behaviour below is different when u 
remark "lister" and unremark "self.lister"?


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



--
http://mail.python.org/mailman/listinfo/python-list