Python Forum
How to import annoations for python 3.7 and below
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to import annoations for python 3.7 and below
#4
you can check the version work from there, but you will need to do so (branch the code) not only for the import but elsewhere in the code where you would otherwise use annotations. It will clutter the code.

to fix the first line problem - you can have a "helper" file, e.g. myannotation.py with only the from __future__ import annotations line (i.e. on the first line)
then you can import that file/module in the if block or with the try block

the cleanest way is to develop on same version as production (assuming you don't want or can't upgrade the production)
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply


Messages In This Thread
RE: How to import annoations for python 3.7 and below - by buran - Dec-18-2019, 01:26 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Tool to adding type annoations Beliavsky 1 1,928 Dec-18-2019, 04:25 PM
Last Post: snippsat
  wordpress-python-xmlrpc. I can import 1 file. How do I import the entire folder? SamLearnsPython 0 3,286 Jul-05-2018, 06:21 AM
Last Post: SamLearnsPython

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020