Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spec: Specify how inheriting from Any works #1546

Open
gvanrossum opened this issue Dec 17, 2023 · 2 comments
Open

Spec: Specify how inheriting from Any works #1546

gvanrossum opened this issue Dec 17, 2023 · 2 comments
Labels
topic: typing spec For improving the typing spec

Comments

@gvanrossum
Copy link
Member

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.)

@gvanrossum gvanrossum added the topic: typing spec For improving the typing spec label Dec 17, 2023
@gvanrossum gvanrossum changed the title Specify how inheriting from Any works Spec: Specify how inheriting from Any works Dec 17, 2023
@hauntsaninja
Copy link
Collaborator

hauntsaninja commented Dec 17, 2023

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/typing-sig@python.org/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.

@superbobry
Copy link

superbobry commented Dec 18, 2023

Strong +1 for specifying the semantics for this.

Prior discussion on typing-sig: https://mail.python.org/archives/list/typing-sig@python.org/thread/NEUCPDTUHMH77VOLXIG56Y7SDOECAKHB/#NEUCPDTUHMH77VOLXIG56Y7SDOECAKHB.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: typing spec For improving the typing spec
Projects
None yet
Development

No branches or pull requests

3 participants