-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Prefer __new__
over __init__
for determining callable type of a class
#5647
Comments
Here's an example (simplified from a post in the gitter today) where we get a terrible error message because IntEnum subclasses int.
Curious if you remember what the problematic typeshed |
hauntsaninja
added a commit
to hauntsaninja/mypy
that referenced
this issue
Nov 3, 2024
Fixes python#5647 See also python#5642
hauntsaninja
added a commit
to hauntsaninja/mypy
that referenced
this issue
Nov 3, 2024
Fixes python#5647 See also python#5642
hauntsaninja
added a commit
to hauntsaninja/mypy
that referenced
this issue
Nov 3, 2024
Fixes python#5647 See also python#5642
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
#5642 made
__new__
chosen in more situations but__init__
is still chosen whenone class defines both. The difficulty is that typeshed has a bunch of dodgy
__new__
annotations that need to be cleaned up first.
The text was updated successfully, but these errors were encountered: