[Python-Dev] Python launcher command line usage (Was: 3.2.1 encoding surprise)
Paul Moore
p.f.moore at gmail.com
Tue Jul 19 17:00:57 CEST 2011
On 19 July 2011 02:41, Vinay Sajip <vinay_sajip at yahoo.co.uk> wrote:
> The use of py from the command line is merely a convenience for developers (as
> the PEP says) - it's better to rely on shebang lines together with settings in
> the .ini to get the behaviour you want.
But it's a *huge* convenience for running multiple Python versions,
particularly as no existing Python versions install executables with
the version in the name (python3.exe, python3.2.exe, etc).And BAT
files aren't a suitable option (I'll rant about the issues with BAT
files if you want, but I recommend you don't ask :-))
Being able to say py -3, py -2.7, etc, rather than having to hack
PATH, create renamed copies of exes, etc, is arguably more of a
benefit to me than shebang support.
This may explain why I'd like to see a command-line means of invoking
custom commands. Something like py.exe looking at an initial argument,
and if it's of the form "-cmd" for a command in py.ini, then run that
command, passing remaining arguments just as for py -3. (Maybe --cmd
to match standard long option usage would be better?)
Presumably, if this idea is to go anywhere, it would need adding to
the PEP. Mark, do you think it would be useful? It makes it possible
to invoke IronPython/Jython in the same manner as CPython. (And, of
course, to abuse things so that "py -perl" runs Perl, but no-one would
do that :-))
Paul.
More information about the Python-Dev
mailing list