Given the following class:
class Test:
def __init__(self, test_prop: str):
self.__test_prop = test_prop
@property
def test_prop(self) -> str:
return self.__test_prop
How can I dynamically access the type annotation of test_prop either from the class or an instance?
The following does not work:
t1 = Test('a')
import inspect
inspect.signature(t1.test_prop)
# TypeError: 'a' is not a callable object