Compiler directives in the source

Alex Martelli aleax at aleax.it
Thu Feb 6 08:21:34 EST 2003


Michael Hudson wrote:
   ...
>> -x     : skip first line of source
> 
> I've never understood the purpose of -x.

I think it's meant to support systems without shebang: in such
systems you can sometimes write a script such that the first
line contains all the magic needed to feed the script file
itself to Python -- but it may be impossible to make that first
line itself acceptable to Python (e.g. a comment, as in the
case of the shebang), whence the -x.

Of course, it seems absurd to say *in the source itself* that 
the first line of that source should have been skipped, at least
in the general case -- the first line may already have messed 
things up (e.g. if on some weird system that first line has
to start with ''' and contain no other ''' -- how could Python 
possibly know "retroactively" that something else in the file
was meant as a directive).


Alex





More information about the Python-list mailing list