Well, a change to
On the other hand, I'm still quite sure that using F5 on IDLE 3 runs code in Python 3 and on IDLE 2 runs code in Python 2, as it gives the correspondig Tracebacks when the code is written for the other version.
Edit:
I experimented a bit with the proposed code snippet:
Using IDLE, I always get the output corresponding to the IDLE version. The is, running the snippet as cited (referring to python2) in IDLE 3 shows:
#! python3
has no visibly effect. But maybe I misunderstood this again. That still happens sometimes.On the other hand, I'm still quite sure that using F5 on IDLE 3 runs code in Python 3 and on IDLE 2 runs code in Python 2, as it gives the correspondig Tracebacks when the code is written for the other version.
Edit:
I experimented a bit with the proposed code snippet:
#! python2 import sys sys.stdout.write("hello from Python %s\n" % (sys.version,))From the command line, I got - according to the setting of the #!-line -:
Output:C:\...>py systest.py
hello from Python 3.4.3 (v3.4.3:9b73f1c3e601, Feb 24 2015, 22:43:06) [MSC v.1600
32 bit (Intel)]
C:\...>py systest.py
hello from Python 2.7.9 (default, Dec 10 2014, 12:24:55) [MSC v.1500 32 bit (Int
el)]
Fine enough.Using IDLE, I always get the output corresponding to the IDLE version. The is, running the snippet as cited (referring to python2) in IDLE 3 shows:
Output:hello from Python 3.4.3 (v3.4.3:9b73f1c3e601, Feb 24 2015, 22:43:06) [MSC v.1600 32 bit (Intel)]
And it's the same vice cersa.