Closed usefulalgorithm closed 10 months ago
For older versions of Python it is not allowed to write union types like
Foo = Bar | Baz
This would not work even if from __future__ import annotations is in the code.
from __future__ import annotations
To make it compatible with Python < 3.10, it has to be:
from typing import Union Foo = Union[Bar, Baz]
Note that with from __future__ import annotations it is OK to have the following in Python <3.10:
def foo( bar: str | int, ):
Thanks!
Good catch! Thanks. I've merged and will publish a PyPi shortly.
Published 0.4.0!
https://pypi.org/project/proto-schema-parser/#history
For older versions of Python it is not allowed to write union types like
This would not work even if
from __future__ import annotations
is in the code.To make it compatible with Python < 3.10, it has to be:
Note that with
from __future__ import annotations
it is OK to have the following in Python <3.10:Thanks!