Closed
Description
This was brought up in python/mypy#1136 (comment) -- Tornado's utf8() function really needs to use @overload
but, since they want to use inline annotations, they can't. The type would be something like
@overload
def utf8(value: None) -> None: ...
@overload
def utf8(value: bytes) -> bytes: ...
@overload
def utf8(value: str) -> bytes: ... # or (unicode)->bytes, in PY2
This can't comfortably be expressed using type vars (at least I couldn't figure it out).
Metadata
Metadata
Assignees
Labels
No labels