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

Mark Hammond mhammond at skippinet.com.au
Mon Oct 24 03:15:39 CEST 2011


On 24/10/2011 11:46 AM, Nick Coghlan wrote:
> On Mon, Oct 24, 2011 at 10:00 AM, Mark Hammond<skippy.hammond at gmail.com>  wrote:
>> * The "magic" symbol is somewhat self-documenting - it implies a question.
>>   Using  --which adds another special case that people would need to
>> understand isn't passed to Python.  IOW, I like that there is only 1 special
>> option and that one special option can be expressed in the form of a
>> question.
>
> This may be a difference in what we're used to. To me, the "-?" is
> strongly associated with "-h" and "--help"

Fair enough - and I admit to thinking -? didn't work for Python - but it 
does!

>, whereas "--which" maps directly to the *nix "which" command:

Sure, but this isn't for *nix, so I'm not sure it is safe to assume the 
users of the launcher will make that association.

> So I don't actually see any particularly *new* design decisions to be
> made in relation to a "--which" option - it's just a workaround for
> the lack of a native 'which' equivalent on Windows,

Actually I don't think that is true - even with a 'which' on Windows you 
can't get this information from it.  Indeed, this functionality is quite 
distinct from that offered by which.

TBH I'm not that bothered - I just have a slight uneasiness to this new 
special option which really just helps describe what a different special 
option does.

So - in an effort to talk myself out of my idea... :)  one advantage 
--which would have is that it could work without any version qualifiers 
at all - eg:

% py --which path/to/script.py

could also tell you what version of Python would be used to execute the 
named script, taking into account the current defaults, environment 
variables and shebang line found in the script.

Cheers,

Mark


More information about the Python-Dev mailing list