You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
PEP 695 introduces the concept of type defaults for type parameters, including TypeVar and TypeVarTuple, which act as defaults for type parameters for which no type is specified. We can use this new information in the same way as we do with bound parameter.
Describe the solution you'd like
Use the new __default__ parameter on a par with the __bound__ parameter giving priority to the first.
The following examples will be equivalent (we will assume x to be int):
T=TypeVar("T", default=int)
@dataclassclassMyClass(Generic[T]):
x: T
T=TypeVar("T", bound=int)
@dataclassclassMyClass(Generic[T]):
x: T
@dataclassclassMyClass[T: int]:
x: T
Additional context
We should support this new PEP for TypeVarTuple as well. All the examples from PEP 696 can be used in new tests.
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem? Please describe.
PEP 695 introduces the concept of type defaults for type parameters, including
TypeVar
andTypeVarTuple
, which act as defaults for type parameters for which no type is specified. We can use this new information in the same way as we do withbound
parameter.Describe the solution you'd like
Use the new
__default__
parameter on a par with the__bound__
parameter giving priority to the first.The following examples will be equivalent (we will assume
x
to beint
):Additional context
We should support this new PEP for
TypeVarTuple
as well. All the examples from PEP 696 can be used in new tests.The text was updated successfully, but these errors were encountered: