Skip to content

Clarify callback protocol example#10061

Closed
MarcoGorelli wants to merge 1 commit intopython:masterfrom
MarcoGorelli:callback-protocols
Closed

Clarify callback protocol example#10061
MarcoGorelli wants to merge 1 commit intopython:masterfrom
MarcoGorelli:callback-protocols

Conversation

@MarcoGorelli
Copy link
Copy Markdown
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
Copy Markdown
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