On 1/3/11, Walter Prins <wpr...@gmail.com> wrote: > 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,...) I see, and this does indeed now work! Thanks! > > Have a good 2011... ;) > > Walter >
-- Have a great day, Alex (msg sent from GMail website) mehg...@gmail.com; http://www.facebook.com/mehgcap _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor