Dec-16-2019, 05:30 AM
I want to have code that uses Python 3.7's
but I also want the code to run on older versions of Python (e.g. 3.5).
I have tried:
Thanks,
Brendan.
from __future__ import annoations,
but I also want the code to run on older versions of Python (e.g. 3.5).
I have tried:
try: from __future__ import annotations except ImportError: passbut that fails with:
File "test_import_annotations.py", line 6 from __future__ import annotations ^ SyntaxError: future feature annotations is not definedIs there any way to guard the import so that it will be ignored on older python versions, but work with python versions that support the import ?
Thanks,
Brendan.