4 ms·
It kind of works, you just have to use `typing.get_annotations(func)` instead of `func.__annotations__`. Although if you aren't importing the types used in your
by durumu 3y ago
It kind of works, you just have to use `typing.get_annotations(func)` instead of `func.__annotations__`. Although if you aren't importing the types used in your annotations that isn't going to work... I would guess that's rare in practice.
- guappa 3y agoIf you define a class inside another class or a function, get_annotations() will never be able to resolve it and just return a string, which is not very useful.