[Python-Dev] PEP397 no command line options to python? (original) (raw)

Nick Coghlan ncoghlan at gmail.com
Sat Oct 22 01:46:37 CEST 2011


On Wed, Oct 19, 2011 at 10:17 PM, Sam Partington <sam.partington at gmail.com> wrote:

Ok ok, I give up.  Apparently I am the only one who wants to be able to run different versions of python based on the shebang line AND add occasional arguments to the python command line.

As a simpler alternative, I suggest the launcher just gain a "--which" long option that displays the full path to the interpreter it found.

So:

C:> py -2 --which C:\Python27\python.exe

C:> py -3 --which C:\Python32\python.exe

No significant complexity in the launcher, and if you want to add additional arguments like -m, -c, or -i you can do it by running '--which' and switching to invoking that interpreter directly. "-i" in particular is invaluable for the following scenario:

And, of course, the "-m" use case has already been mentioned to invoke modules by module name rather than file name ("python -m timeit", anyone?)

Cheers, Nick.

-- Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia



More information about the Python-Dev mailing list