You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
PEP 484: Allow annotating first argument of instance and class methods - #89
@JukkaL The third example works in mypy (with appropriate function bodies), Guido wants to double check that mypy could be patched so that first two examples also work.
This looks good to me, and I believe that it won't be very hard to get this working in mypy. But I haven't actually done more than thought experiments.
In python/mypy#2193 (comment), @elazarg expresses some doubts about the feasibility of this approach. I haven't thoroughly ingested his comments yet but I thought I'd call it out here.
I also think the syntax suggested here is more appropriate for the interface thing, while the examples in this PEP change seems to be about mixins. It is of course somewhat a matter of taste, but I think it is not entirely subjective.
@gvanrossum@elazarg To be honest, I still could not clearly see the difference between the two use cases (probably it is to much blurred for me). But what I could say is in my opinion both examples in the PR (and two examples Guido gave in mypy tracker) if what we are interested in. Also I think the syntax should be self: T, at least for me it is clear what it means (it more-or-less simply allows generic function semantics for methods).
FYI Most of the discussion continues in the mypy PR.
ilevkivskyi
changed the title
[WIP] PEP 484: Allow annotating first argument of instance and class methods
PEP 484: Allow annotating first argument of instance and class methods
Oct 29, 2016
@gvanrossum Since support for this feature (at least the functionality described in this PR) is now in mypy python/mypy#2193 , I think this PR could be merged.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes python/typing#271 and python/mypy#1212
@JukkaL @gvanrossum
Please review.
@JukkaL The third example works in mypy (with appropriate function bodies), Guido wants to double check that mypy could be patched so that first two examples also work.