When ‘super’ is not a good idea (was: 'Once' properties.)

Ben Finney ben+python at benfinney.id.au
Wed Oct 7 01:09:51 CEST 2009


Scott David Daniels <Scott.Daniels at Acm.Org> writes:

> Scott David Daniels wrote:
> >     class Initialized(ClassBase):
> >         @classmethod
> >         def _init_class(class_):
> >             class_.a, class_.b = 1, 2
> >             super(Initialized, class_)._init_class()
>
> Mea culpa:  Here super is _not_ a good idea, 
[…]

Why is ‘super’ not a good idea here?

>     class Initialized(ClassBase):
>         @classmethod
>         def _init_class(class_):
>             class_.a, class_.b = 1, 2
>             ClassBase._init_class()

What makes this implementation better than the one using ‘super’?

-- 
 \        “I was once walking through the forest alone and a tree fell |
  `\       right in front of me, and I didn't hear it.” —Steven Wright |
_o__)                                                                  |
Ben Finney



More information about the Python-list mailing list