Closed
Description
Take the following class:
class Base: pass
class Derived(Base): pass
T = TypeVar('T', bound=Base)
class MyType(Generic[T]):
pass
myvar: 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:
class Base: pass
class Derived(Base): pass
T = TypeVar('T', bound=Base, default=Base)
class MyType(Generic[T]):
pass
myvar: MyType = None # type of `myvar` is `MyType[Base]`
or (I know this is invalid syntax, but it's the idea that counts):
class Base: pass
class Derived(Base): pass
T = TypeVar('T', bound=Base)
class MyType(Generic[T, default=Base]):
pass
myvar: MyType = None # type of `myvar` is `MyType[Base]`