Take the following class:
classBase: passclassDerived(Base): passT=TypeVar('T', bound=Base)
classMyType(Generic[T]):
passmyvar: MyType=None# type of `myvar` is `MyType[Any]`My idea is to allow for some way to specify a default other than any when the parameters are omitted. For example:
classBase: passclassDerived(Base): passT=TypeVar('T', bound=Base, default=Base)
classMyType(Generic[T]):
passmyvar: MyType=None# type of `myvar` is `MyType[Base]`or (I know this is invalid syntax, but it's the idea that counts):
classBase: passclassDerived(Base): passT=TypeVar('T', bound=Base)
classMyType(Generic[T, default=Base]):
passmyvar: MyType=None# type of `myvar` is `MyType[Base]`
Take the following class:
My idea is to allow for some way to specify a default other than any when the parameters are omitted. For example:
or (I know this is invalid syntax, but it's the idea that counts):