[Python-Dev] PEP397 no command line options to python?

Vinay Sajip vinay_sajip at yahoo.co.uk
Tue Oct 18 09:10:17 CEST 2011


>>  From a desire to keep the launcher as simple as possible, and to minimise 

> the
>>  need to synchronise the launcher with command line parameter changes in 
> future
>>  versions of Python.
> 
> As simple as possible yes... but no simpler.  I think having
> pylauncher behave so differently in the two cases of :
> 
> py -u test.py
> py test.py
> 
> Is very unexpected. And to do so silently, without warning will cause

It's only unexpected if you don't read the PEP. From there:

"The launcher may offer some conveniences for Python developers working
interactively - for example, starting the launcher with no command-line
arguments will launch the default Python with no command-line arguments.
Further, command-line arguments will be supported to allow a specific
Python version to be launched interactively - however, these conveniences
must not detract from the primary purpose of launching scripts and must
be easy to avoid if desired."

> real headaches_ for users, *especially* since py -h lists -u as one of
> the options, it does not say 'here are the python options but you must
> call PythonXX/python.exe to use them'.

Well, it's easy enough to make that clearer in the help output of py.exe :-)
 
> [headaches : it did for me as I ended up with a broken build of my app
> due to different parts of my app built for different pythons.]

Why does the need arise to invoke py.exe in a build system? Why not just reference the Python executable you want directly?

> To fix this the launcher doesn't need to track all python command line
> options, only those that take two args.  I don't really see that it
> will be such a maintenance burden to have the launcher track any new
> ones.  Python has only two such options after 20 years of development.
> 
> As for complexity it's less than 10 lines of C.

Plus tests, presumably ... let's see 'em :-)
 
> That's a cool feature which I'd not really read up on, but that
> requires a global configuration file change, it's not doable on a per
> usage basis.

Per usage = interactively, which is more of a "by-the-by" feature for the launcher, the main purpose being to bring shebang-line functionality to Windows.

Regards,

Vinay Sajip


More information about the Python-Dev mailing list