On Mon, 2005-01-17 at 10:59 -0800, Chad Crabtree wrote:
> class NewCharacter(Character):
>   def __init__(self,stats,*args,**kwds):
>     super(Character,self).__init__(*args,**kwds)
>     self.stats=stats
> 
> super is a function that calls a specific function from a parent
> class. This way you can still use the previous __init__ code and then extend
> it. 

Is that the right idiom these days?

I would write:

def __init__(self, stats, *args, **kw):
    Character.__init__(self, *args, **kw)
    self.stats = stats

-- 
John.
_______________________________________________
Tutor maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/tutor

Reply via email to