[Python-ideas] CLI option for isolated mode

Mike Meyer mwm at mired.org
Fri Nov 16 00:18:10 CET 2012


On Nov 15, 2012 3:43 PM, <random832 at fastmail.us> wrote:
>
> On Wed, Nov 14, 2012, at 19:25, Steven D'Aprano wrote:
> > Shebang lines aren't interpreted by Python, but by the shell.
> >
> > To be precise, it isn't the shell either, but the program loader, I
> > think.
> > But whatever it is, it isn't Python.
>
> That's obviously untrue - the shell or the kernel or whatever piece it
> is doesn't know what an -E or a -s does, it simply passes them to
> python. Now, as the error messages show, it passes them as a single
> string rather than (as you would ordinarily expect) as two strings, but
> it's all _there_ for python to see, even without trying to read it from
> the file (which it also could do).

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.

While python could in theory start reading and interpreting the shebang
line, I don't think there's a sane way to decide when to do so since you
can set the arguments on the command line by invoking scripts explicitly.

      <mike
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20121115/cb1d9196/attachment.html>


More information about the Python-ideas mailing list