[Python-ideas] Thread.__init__ should call super()
Guido van Rossum
guido at python.org
Fri Oct 27 19:27:55 EDT 2017
You can subclass Thread just fine, you just can't have it in a multiple
inheritance hierarchy except at the end of the MRO (before object). That
shouldn't stop you from doing anything you want though -- you can define
e.g.
class MyThread(Thread):
def __init__(self, *args, **kwds):
Thread.__init__(self, *args, **kwds)
super(Thread, self).__init__(*args, **kwds)
and use this class instead of Thread everywhere. (You'll have to decide
which arguments to pass on and which ones to ignore, but that's not
specific to the issue of Thread.)
Of course you're probably better off not trying to be so clever.
On Fri, Oct 27, 2017 at 1:59 PM, Ilya Kulakov <kulakov.ilya at gmail.com>
wrote:
> Since one of the legit use-cases of using the Thread class is subclassing,
> I think it's __init__ should call super() to support cooperative
> inheritance.
>
> Or perhaps there is a good reason for not doing so?
>
> Best Regards,
> Ilya Kulakov
>
>
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/
>
>
--
--Guido van Rossum (python.org/~guido)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20171027/c12153e7/attachment.html>
More information about the Python-ideas
mailing list