Skip to content

Is there a way to simultaneously bind and set a TypeVar default with PEP 695 syntax? #8210

Answered by erictraut
max-muoto asked this question in Q&A
Discussion options

You must be logged in to vote

Yes, you can set both a bound and a default, like this:

class Foo[T: float = int]: ...

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by max-muoto
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants