[Python-ideas] Make py.exe default to Python 3

Andrew Barnert abarnert at yahoo.com
Sat Mar 12 23:09:37 EST 2016


On Mar 12, 2016, at 15:38, Oscar Benjamin <oscar.j.benjamin at gmail.com> wrote:
> 
>> On 9 March 2016 at 21:25, Chris Angelico <rosuav at gmail.com> wrote:
>>> On Thu, Mar 10, 2016 at 8:20 AM, Mark Lawrence <breamoreboy at yahoo.co.uk> wrote:
>>> I do not believe that this needs a PEP, a tracker item should be fine IMHO.
>>> We should just ensure that the original authors of the PEP are aware, as
>>> missing out their opinions would be a disservice to the Python Windows
>>> community, as small as that may be when compared to *nix.
>> 
>> Given that this is basically a Windows-only change, it doesn't matter
>> how large or small the Windows community is - they're the people who
>> primarily matter :) If someone proposed a change to the way things are
>> done on OS/2, it'd be worth getting the opinions of both of the Python
>> OS/2 users... :P
> 
> Although it is a change to Windows-only I think it is important to
> think about the consistency between the way that this works on Windows
> compared with other operating systems. Inconsistencies here can be
> awkward for novices. Allow me to spell out my scenario...
> 
> I teach a couple of University programming units in which students
> learn to program in Python, C and Java. The cohort for these units
> this year was 160 students. I often find myself giving the students
> instructions such as you can run this script I've given you with
> 
>    $ python myscript.py
> 
> Now imagine that you've given that instruction to 160 students mostly
> using Windows and OSX (and a few Linux users). I find it very annoying
> that this could invoke Python 2 or 3 depending on the OS etc that the
> students are using. py.exe should solve this since I can write py -3
> and then (I assume) it would lead to an error if no Python 3 version
> is available. However that doesn't work on OSX or Linux.

What if Python 3 created a symlink (or, for non-NTFS drives, a copy) of Python.exe named Python3.exe? Would that be sufficient for you to just tell your students to run:

    $ python3 myscript.py

At any rate, this seems to be a separate issue from the one this thread is about. It's already true that py.exe is Windows-specific; no change to what it does is going to make the same command lines work on Windows and *nix. Only some new proposal (add a py command for Unix, add python2 and python3 links for Windows, make Python.exe itself a dispatcher as Apple's /usr/bin/python is on Mac, ...) is going to help you. So you might be better off creating a new thread instead of adding on to one that's mostly been resolved and a lot of people have stopped reading.


More information about the Python-ideas mailing list