Python: Best way to check for Python version in program that uses new language features?
- by Mark Harrison
If I have a python script that requires at least a particular
version of python, what is the correct way to fail gracefully
when an earlier version of python is used to launch the script?
How do I get control early enough to issue an error message
and exit?
For example, I have a program that uses the ternery operator (new in 2.5) and "with"…