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

Steven D'Aprano steve at pearwood.info
Fri Oct 27 19:21:53 EDT 2017


On Fri, Oct 27, 2017 at 01:59:01PM -0700, Ilya Kulakov 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?

Are you talking about threading.Thread or some other Thread?

If you are talking about threading.Thread, its only superclass is 
object, so why bother calling super().__init__?

To be successful, it would need to strip out all the parameters and just 
call:

    super().__init__()

with no args, as object.__init__() takes no parameters. And that does 
nothing, so what's the point?

I'm afraid I don't see why you think that threading.Thread needs to call 
super. Can you explain?


-- 
Steve


More information about the Python-ideas mailing list