typing
typing copied to clipboard
Spec: Specify how inheriting from Any works
I can't find anywhere in the current spec where we specify how inheriting from Any should work. I've heard that it's relied upon in typeshed. (E.g. class pmem(Any) in gevent and psutil, and class _NotImplementedType(Any) in builtins.)
An enlightening use case in typeshed we use this for is typing Mock (specifically NonCallableMock)
There was also some discussion a few months back in https://mail.python.org/archives/list/[email protected]/thread/NEUCPDTUHMH77VOLXIG56Y7SDOECAKHB/#NEUCPDTUHMH77VOLXIG56Y7SDOECAKHB (reply from Eric, reply from me)
I'd propose that we treat it the same as subclassing an unknown symbol, although to my knowledge how that should be treated is not really specified either.
Strong +1 for specifying the semantics for this.
Prior discussion on typing-sig: https://mail.python.org/archives/list/[email protected]/thread/NEUCPDTUHMH77VOLXIG56Y7SDOECAKHB/#NEUCPDTUHMH77VOLXIG56Y7SDOECAKHB.