Point: Python is a moving target.
Point: Based on the version/sub-version you have installed, syntax for various statements, functions, and features can vary over wide limits, causing code written for one version to be totally incompatible with a different version and/or sub-version.
Which leads to the following Musical Question:
Is it possible, somehow, within the context of a python script, to determine what version it's being run against?
Viz.:
Code: Select all
(some code goes here)
if [version of python] < 3:
print(version of print compatible with v2.n)
elif [version of python] < 4:
print(version of print compatible with v3.n)
else:
print("Unknown version of Python!)
[exit program]
Code: Select all
(program code goes here)
if [version of python] < 3
raw_input(. . . . . .)
elif [version of python] < 4
input(. . . . . .)
else:
[throw error, etc.]
(more code here)
Any ideas?
Thanks!