pure aesthetic question

Helmut Jarausch jarausch at skynet.be
Sun May 18 14:32:10 EDT 2003


Alex Martelli wrote:
> <posted & mailed>
> 
> Helmut Jarausch wrote:
> 
> 
>>as far as I know I have to put a Python script
>>into a file with suffix '.py' (e.g. BackUp.py)
>>and if it gets compiled there is a BackUp.pyc or
>>BackUp.pyo file.
> 
> 
> This is a must only for source files you want to
> import as modules (indeed the compilation only
> happens for such modules).
> 
> 
>>Is it possible (under Linux) to get the plain name
>>BackUp
>>which executes the compiled and/or optimized script
>>when invoked by the shell (system)
> 
> 
> Sure!  Put the textfile named BackUp on some directory
> on your $PATH, chmod +rx it, and have as its first line:
> 
> #!/usr/local/bin/python
> 
> or whatever other path invokes your favourite Python -- a
> popular choice is:
> 
> #!/usr/bin/env python
> 
> 
> You can also have commandline switches on that line,
> such as a trailing -O to tell Python to "optimize".
> 

Many thanks,
as far as I understand, it compiles the script each time
it's invoked?
Furthermore, though not important in my case, the script
not just the bytecode, is freely readable to anyone who
is allowed to invoke it?

Helmut.



-- 
Helmut Jarausch

Lehrstuhl fuer Numerische Mathematik
RWTH - Aachen University
D 52056 Aachen, Germany





More information about the Python-list mailing list