Skip to content
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

Clarify callback protocol example #10061

Closed
wants to merge 1 commit into from

Conversation

MarcoGorelli
Copy link
Contributor

@MarcoGorelli MarcoGorelli commented Feb 10, 2021

Description

xref https://stackoverflow.com/q/66068202/4451315

The current example, when run without the double underscore prefix, doesn't error. I found this a bit confusing, and wasn't sure what the example was meant to teach me.
I'd like to think that the proposed change clarifies it.

Like this, remove the double underscore prefix gives:

$ mypy t.py 
t.py:14: error: Incompatible types in assignment (expression has type "Callable[[T], T]", variable has type "Copy")
t.py:14: note: "Copy.__call__" has type "Callable[[Arg(T, 'origin')], T]"
Found 1 error in 1 file (checked 1 source file)

Test Plan

None (just simple doc change)

@MarcoGorelli
Copy link
Contributor Author

I presume this isn't wanted, sorry for the noise

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant