Skip to content

How to type the self argument in a Protocol for a decorator? #9402

Answered by erictraut
DanielNoord asked this question in Q&A
Discussion options

You must be logged in to vote

Could you explain why pyright accepts the code without the / and mypy doesn't?

Pyright treats self and cls as positional-only in this case. This hasn't yet been clarified in the typing spec, but there seems to be general consensus that it should be. See here.

Replies: 1 comment 6 replies

Comment options

You must be logged in to vote
6 replies
@DanielNoord
Comment options

@erictraut
Comment options

Answer selected by DanielNoord
@DanielNoord
Comment options

@erictraut
Comment options

@DanielNoord
Comment options

@erictraut
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants