[Python-ideas] CLI option for isolated mode

Mike Meyer mwm at mired.org
Mon Nov 19 04:32:20 CET 2012



Random832 <random832 at fastmail.us> wrote:

>On 11/15/2012 6:18 PM, Mike Meyer wrote:
>> It's obviously true. The kernel (or shell, as the case may be) 
>> interprets the shebang line to find the executable an pick out the 
>> arguments to pass to the executable. The executable (Python) then 
>> interprets the arguments, without ever having seen the shebang line.
>Right. It **interprets the arguments**. In this case, the single 
>argument is "-E -s", there's no reason it couldn't or shouldn't treat 
>that the same way as "-E" "-s".

I've got three reasons to not do that:

  Special cases aren't special enough to break the rules.
  Errors should never pass silently.
  In the face of ambiguity, refuse the temptation to guess.

If you knew you were handling a shebang line, it might be different. But if a user went out of their way to pass those arguments on the command line, you want to be very careful about undoing what they did.

I think providing single-letter variants for options (which was why this was pointed out) is a better solution than guessing about what the user wanted to do to silently surpress an error to handle the special case of not being able to have multiple arguments on a shebang line (for some OS's?).
-- 
Sent from my Android tablet with K-9 Mail. Please excuse my swyping.



More information about the Python-ideas mailing list