Uh oh!
There was an error while loading. Please reload this page.
Callable generic type alias without parameter #1134
Answered
byerictraut
decorator-factory
asked this question in
Q&A
QuestionWhen a generic callable type alias, like It seems to me that the latter should be used (to be consistent with generic classes, e.g. Codefromcollections.abcimportCallablefromtypingimportTypeVarT=TypeVar("T")
deff1() ->Callable[[T], T]:
...
g1=f1()
reveal_type(g1)
reveal_type(g1(42))
Hmm=Callable[[T], T]
deff2() ->Hmm:
...
g2=f2()
reveal_type(g2)
reveal_type(g2(42))Pyright's (1.1.237) answerMypy's (0.942) answer |
Answered by
erictraut
Apr 14, 2022
Replies: 1 comment 1 reply
I think this is an inconsistency (i.e. a bug) in pyright. It should mirror the behavior of mypy in this case. I'll fix it. |
1 reply
Answer selected bydecorator-factory
Sign up for freeto join this conversation on GitHub.
Already have an account?
Sign in to comment
I think this is an inconsistency (i.e. a bug) in pyright. It should mirror the behavior of mypy in this case. I'll fix it.