Sorry, my last post was too hasty.  You also had a problem calling super.
It should be like this:

class parent(object):
 def __init__(self, l=None):
   if l is None: self.l=[]
   else: self.l=l

class child(parent):
 def __init__(self, *args, **kwords):
   super(child, self).__init__(*args, **kwords)
   self.l.append(5)

c=child()
print c.l

Basically: In Python 2.x "super()" doesn't know what the current class is.
You have to tell it, as the first parameter.  If you tell it a lie, strange
things will happen.  That's basically what you did.  You called
super(parent,...) instead of super(child,...)

Have a good 2011... ;)

Walter
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to