-
Notifications
You must be signed in to change notification settings - Fork 267
Open
Labels
topic: featureDiscussions about new features for Python's type annotationsDiscussions about new features for Python's type annotations
Description
I would like to be able to access the type arguments of a class from its class methods.
To make this concrete, here is a generic instance:
import typing
import typing_inspect
T = typing.TypeVar("T")
class Inst(typing.Generic[T]):
@classmethod
def hi(cls):
return cls
I can get its generic args:
>>> typing_inspect.get_args(Inst[int])
(int,)
But, these seem to get erased inside the class methods:
>>> typing_inspect.get_args(Inst[int].hi())
()
reliveyy, anhldbk, Artemis21, natemcmaster, shaunc and 38 more
Metadata
Metadata
Assignees
Labels
topic: featureDiscussions about new features for Python's type annotationsDiscussions about new features for Python's type annotations