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

Mark Hammond skippy.hammond at gmail.com
Mon Oct 24 02:00:45 CEST 2011


On 24/10/2011 10:36 AM, Nick Coghlan wrote:
> On Mon, Oct 24, 2011 at 8:15 AM, Mark Hammond<skippy.hammond at gmail.com>  wrote:
>> How about abusing the existing flags for this purpose - eg:
>>
>> % py -3?
>> % py -2.7?
>
> What does using the magic symbol offer over an explicit separate flag?

* 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.

* Simplicity - does "py -2.3 --which" work the same as "py --which 
-2.3"?  If not, that's not at all intuitive.  If so, it adds complexity 
to the launcher and the PEP text.

* Extensibility - While I've resisted, I predict that due to popular 
demand, we will wind up supporting additional arguments which are passed 
directly to Python (eg, "py -2.3 -W scriptName").  If we did, how would 
we treat --which when it is specified with additional options?

So to turn the question back around - why introduce a new special option 
when the existing single special option can be leveraged?  Are we 
opening the door to further special options?

I guess the key downside to this suggestion is that it doesn't allow you 
ask where the default Python is without using "-2?" (or maybe just -?)

Mark


More information about the Python-Dev mailing list