I have a python units package. I want to have both Å
and angstrom
be two aliases for angstroms, so that people can use whichever one they prefer (Å
is easier to read but angstrom
is easier to type). Since unicode identifiers are forbidden in Python 2, the Å
option will obviously only be available in Python 3. My question is: Is there any way to have a single source file that works in both Python 2 and Python 3, and has this variable defined in Python 3 only?
The naive solution if sys.version_info >= (3,): Å = angstrom
does not work, because Python 2 raises a syntax error.