[Python-Dev] Draft PEP and reference implementation of a Python launcher for Windows
Terry Reedy
tjreedy at udel.edu
Mon Mar 21 01:34:23 CET 2011
On 3/20/2011 6:35 PM, Westley MartÃnez wrote:
> On Sun, 2011-03-20 at 05:36 -0400, Terry Reedy wrote:
>> As both a writer and reader, I would like to just add, for instance,
>>
>> #! python3
>>
>> (or 3.3 or whatever) and have the launcher do the 'right thing'.
>> It seems to me that that really should be enough info for *nix,
>> but given that it is not, a program to add the required extra noise for
>> a particular distribution to the first line of every module in a package
>> should not be too difficult.
>>
>> The above would be easy for anyone to write and understand.
>>
> That would break the whole point of platform-independence. UNIX won't
> understand that, and I don't think we're gonna be able to convince all
> the kernel developers to implement this simplified shebang.
Given that the default for code developed on windows is NO #! line (and
that may also be true for new programmers in *nix too, for all I know),
I should think that the above would be an improvement. It does not
require new Python programmers on Windows to know anything about *nix
(pseudo?)paths, nor about the '/' versus '\' fuss. One should only need
to know all that if one wishes to distribute to *nix *and* to have
script files directly executable. (I presume 'python x.py' does not
require a #! line on *nix either.)
For people who do want to do that, I already suggested that there be a
program that scans through a directory tree, looking for files that
start with '#! " and replacing that when found with '#!/usr/bin/env ' or
whatever. That could be done once, before distribution. And it would not
even require understanding of the substitution.
--
Terry Jan Reedy
More information about the Python-Dev
mailing list