Open Horstage opened 5 years ago
Further investigation show that you could get the type hints via typing.get_type_hints(Foo)
.
Oh, I don't like this... I can see why they're doing this, but it makes things a bi tharder. Thanks for letting me know :)
Type annotations can be Strings and with Python 4.0 will always be handled as such (PEP 484). As of Python 3.7 you can
from __future__ import annotations
to replicated Py4.0 behavior. This package does not work with strings as annotation.I already stumbled on this. Referencing to parent or child objects of the same class is rather common (I believe)
The only solution I see right now is to use
eval
on the annotations. Please prove me wrong.