super(...).__init__() vs Base.__init__(self)

Steven Bethard steven.bethard at gmail.com
Thu Feb 9 12:29:40 EST 2006


Kent Johnson wrote:
> Are there any best practice guidelines for when to use
>   super(Class, self).__init__()
> vs
>   Base.__init__(self)
> to call a base class __init__()?
> 
[snip]
 >
> 3. A third fix might be to change both Base and threading.Thread() to 
> call super(...).__init__(). This might break existing code that is 
> written in the style of fix 1 (calling both base class __init__() 
> methods explicitly).

Personally, I'd call the lack of the super calls in threading.Thread and 
Base bugs.  So code relying on that behavior needs to be fixed when the 
bug is fixed.  But __init__() is definitely a tricky case since the 
number of arguments tends to change in the __init__() methods of classes...

STeVe



More information about the Python-list mailing list