Closed
Description
I'm trying to do something like this:
T = TypeVar('T')
def identity(string):
# type: (str) -> str
return string
def f(normalize=identity):
# type: (Callable[[str], T] -> str)
But mypy says this does not type-check. After adding a cast (normalize=cast(Any, identity)
, or even normalize=cast(Callable[[str], T], identity)
, this works fine.
Metadata
Metadata
Assignees
Labels
No labels