-
-
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
self
argument is not assignable to variable typed as Self
#17760
Comments
I agree this could be improved. FYI, typing |
I took a stab at making It turns out there's a test against that: mypy/test-data/unit/check-selftype.test Lines 1815 to 1830 in f6520c8
I'm not sure I understand the comment about this being a PEP 484 requirement. It seems that pyright gets away making the type of an unannotated |
There's a sentence in PEP 484 about not needing to annotate self and treat it as the type of the containing class. Looks like that sentence is in the current spec too and we should maybe change that: https://typing.readthedocs.io/en/latest/spec/annotations.html#annotating-instance-and-class-methods I don't think that's too much of an issue though, I seem to remember folks were concerned about performance. Let me dig up a reference... |
Yeah, see #14075 (closing this as a duplicate of that) |
Let's also change the spec to be clearer about this python/typing#1860 |
playground
The text was updated successfully, but these errors were encountered: