Draft typing spec chapter for constructors

I don’t agree with removing the Any special case for __call__. As you said, it’s rare that a metaclass overrides __call__ in a way that would change the normal behavior of type.__call__. Typically this is only done in cases where NoReturn is the intended return type. If we treat an Any return type as an indication that the metaclass is overriding the normal behavior, that creates big problems in the case where there is a metaclass __call__ method that happens to be unannotated. We’d need to differentiate between explicit Any and implicit Any (what pyright calls Unknown). That’s not a concept that’s found anywhere in the typing spec right now, and I don’t think this is the time to introduce it. I think the current proposal is preferable.

1 Like