Skip to content

Conditionally specify type for TypeVar with typing.overload #2042

Answered by erictraut
tomasgareau asked this question in Q&A
Discussion options

You must be logged in to vote

I don't see a perfect solution, but here's the best I can offer:

def my_func(q: Queue[Any], deserialize: Optional[Callable[[bytes], Any]]) -> NoReturn:

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
1 reply
@tomasgareau
Comment options

Answer selected by tomasgareau
Comment options

You must be logged in to vote
1 reply
@tomasgareau
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants