[Python-ideas] Thread.__init__ should call super()

Ilya Kulakov kulakov.ilya at gmail.com
Mon Oct 30 15:47:30 EDT 2017

Neil, thank you for doing much better job explaining the problem.

Generally, I'm cool with Python's standard library classes not calling super(), as many of them
are not designed for subclassing. But those which are should do that. E.g. take a look at more
recent asyncio's Protocol and Transport classes: they all properly call super().

One potential problem is that it will break existing code:

class X(Thread, SomethingElse):
    def __init__(self):

SomethingElse.__init__ will be called twice.
Is it a good reason for "old" classes to lag behind? I don't know.

Perhaps some mechanism (invisible to a user) can be designed to avoid that.
E.g. super() may leave a flag which should signal interpreter to "skip" all direct calls
of a function and warn about it (DeprecationWarning?).

Best Regards,
Ilya Kulakov

More information about the Python-ideas mailing list