[Python-ideas] Stub class for Generic to further improve PEP 560
kulakov.ilya at gmail.com
Thu Nov 30 16:38:28 EST 2017
A very rough implementation:
def __getitem__(self, params):
GenericStub = Generic if TYPE_CHECKING else _GenericNoop
T = typing.TypeVar('T')
Now when run under type checkers MyClass will inherit typing.Generic with all runtime complexity.
However when run outside of them code will just work.
> On Nov 30, 2017, at 1:35 PM, Ivan Levkivskyi <levkivskyi at gmail.com> wrote:
> Could you please give some examples for these statements? They still look to abstract for me.
More information about the Python-ideas