You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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)
fromtypingimportOptionalclassFoo:
bar: int# works finebaz: "str"# does not work, but you could simply remove quotation marks for nowchild: "Optional[MyClass]"# does not workparent: "Optional[MyClass]"
The only solution I see right now is to use eval on the annotations. Please prove me wrong.
The text was updated successfully, but these errors were encountered:
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.The text was updated successfully, but these errors were encountered: