list extension ?

bruno.desthuilliers at gmail.com bruno.desthuilliers at gmail.com
Mon Jun 30 16:53:32 EDT 2008


On 30 juin, 21:05, Stef Mientki <stef.mien... at gmail.com> wrote:
> thanks guys,
>
> >>    def __init__ ( self, value = [] ) :
>
> > Gotcha : default argument values are eval'd only once. Also, it would
> > make more sense IMHO to follow the parent's class initializer's
> > behaviour:

Ah hem.... Sorry, should have double-checked:

> >     def __init__(self, *args)
>
> >>        list.__init__ ( self, value )
>
> >          list.__init__(self, *args)
>
> that's even better, except the call must be
>          list.__init__ ( self, args )

Indeed. Which makes my whole comment about "following parent's class
behaviour" totally off-tracks. Should have shut up here :(





More information about the Python-list mailing list