-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Don't instantiate types in __init__
based on self
#16753
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
Conversation
This comment has been minimized.
This comment has been minimized.
(this might be wrong? but I can't think of a counterexample)
This comment has been minimized.
This comment has been minimized.
I'm still not confident that this is the best way to do this, but I think this is ready for a review by someone else (hopefully?) or a merge. |
Bump on this. I was actually thinking about how I would do this today and I think it might be nicer to try adding constraints from the self arg compared to the instance with all generics, but I'm not really sure how to do that. This works as a hack though rereading it I'm not sure how it works. |
According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅ |
This works now without this PR. |
Fixes #16752