Need help: Compiling Python-Code
Michele Simionato
mis6 at pitt.edu
Tue Jul 15 09:20:30 EDT 2003
"Thomas Buschhardt" <thomas.buschhardt at iac-leipzig.de> wrote in message news:<mailman.1058258723.4935.python-list at python.org>...
> import py_compile
> pycompile.compile(Python-file)
>
> Bye Thomas
I am sure the OP has a good reason for asking his question,
nevertheless for the sake of newbies who wonder if they should
byte-compile their scripts, here is an extract from help(py_compile):
Note that it isn't necessary to byte-compile Python modules for
execution efficiency -- Python itself byte-compiles a module when
it is loaded, and if it can, writes out the bytecode to the
corresponding .pyc (or .pyo) file.
However, if a Python installation is shared between users, it is a
good idea to byte-compile all modules upon installation, since
other users may not be able to write in the source directories,
and thus they won't be able to write the .pyc/.pyo file, and then
they would be byte-compiling every module each time it is loaded.
This can slow down program start-up considerably.
Just my 2 cents,
Michele
More information about the Python-list
mailing list