When ‘super’ is not a good idea

Jean-Michel Pichavant jeanmichel at sequans.com
Wed Oct 7 12:14:40 CEST 2009


Ben Finney wrote:
> 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’?
>
>   
a possible answer:
- explicit >> implicit

I'm not sure this is the correct one though :)

JM




More information about the Python-list mailing list