Calling __init__ with multiple inheritance
dickrp at ece.northwestern.edu
Mon Mar 28 21:14:46 CEST 2005
> In the case of Parent diamond inheritance, super() can avoid calling
> the __init__ of parent twice? How?
Guido has a nice description of it:
It linearizes the graph. Unfortunately, this means that super delegates to
siblings. This makes super incompatible with differences in positional
arguments within a class hierarchy. If you want a super that works with
positional arguments, please see delegate.py at
http://ziyang.ece.northwestern.edu/~dickrp/python/delegate.html (also in
PyPI). If others don't find problems with the approach, I hope it becomes
standard. I found it distracting that python's default argument passing
approach conflicts with its default delegation approach.
More information about the Python-list