Google
 
Webnews.only-4-geeks.com
Interesting places
news.only-4-geeks.com Forum Index » Python

Someone enlightened me

 
Jump to:  
 
Marcus Low
PostPosted: Sun Jul 13, 2008 12:11 am    Post subject: 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.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()
 

Page 1 of 1 .:.

Google
 
Webnews.only-4-geeks.com

Windows Update | C++ | C | PHP | JavaScript | Photoshop | Programming | Windows 2000 | Python | Windows XP | Object | Flash | Flash - ActionScript | Paint Shop Pro | Excel | PowerPoint | Access | Word | Windows 98 | Internet Explorer 6.0 | CorelDraw12 | Java | XML | asm x86 | Linux Mandrake | Linux RedHat | Outlook |  | news from newsgroups |_ | s

Web Templates

Awesome Website Templates ©

Życzenia imieninowe Yahoo Palmtopy projekty domów zakłady bukmacherskie