It seems to serve no useful purpose (that I can think off) and adds a lot of complexity to the implementation, especially when concurrency is involved.
Is it just a historical hangover, or is it actually used?
It seems to serve no useful purpose (that I can think off) and adds a lot of complexity to the implementation, especially when concurrency is involved.
Is it just a historical hangover, or is it actually used?
In the stdlib it’s used in typing.NamedTupleMeta. It looks like this is how generics get added to __bases__ if you define something like class NT[T](typing.NamedTuple): .... It’s possible there’s a different way this could be done, but it is currently used.
It’s also used in a few tests, not sure how many of these are solely there to check that something behaves sensibly even if the bases get changed underneath them though.
Personally, I think Python should eventually start deprecating these things. Now with hindsight, we see that the cost to code readers is far greater than the flexibility benefit.