super(...).__init__() vs Base.__init__(self)
Jan Niklas Fingerle
usenet-2004 at lithe.de
Thu Feb 9 15:37:16 EST 2006
Steven Bethard <steven.bethard at gmail.com> wrote:
> Personally, I'd call the lack of the super calls in threading.Thread and
> Base bugs.
It can't be a bug since it wasn't a bug before super was introduced and
you don't wan't to break working Python-2.x-code.
> But __init__() is definitely a tricky case since the
> number of arguments tends to change in the __init__() methods of classes...
ACK. And every __init__ will have to accept *any* arguments you give to
it and call super with *all* the arguments it got. This is tricky and
easily to get wrong. Super is a good tool to use, when dealing with
diamond shape inheritance. In any other case I would use the direct
calls to the base classes. In fact, i've yet to find a non-textbook-case
where I really need diamond shape inheritance. OTOH I don't mean to say
that noone else needs it either.
cu,
--Jan Niklas
More information about the Python-list
mailing list