diff options
author | Georg Brandl <georg@python.org> | 2010-12-04 10:26:46 (GMT) |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2010-12-04 10:26:46 (GMT) |
commit | 8334fd9285a8e9f0864b0453ae738fe3f6893b21 (patch) | |
tree | f9341847b4647cd85b6fcd4e5fbece5cd15e1883 /Doc/library/py_compile.rst | |
parent | 427d3149ebe5c4495e69a04be5464e5b8b446c9e (diff) | |
download | cpython-8334fd9285a8e9f0864b0453ae738fe3f6893b21.zip cpython-8334fd9285a8e9f0864b0453ae738fe3f6893b21.tar.gz cpython-8334fd9285a8e9f0864b0453ae738fe3f6893b21.tar.bz2 |
Add an "optimize" parameter to compile() to control the optimization level, and provide an interface to it in py_compile, compileall and PyZipFile.
Diffstat (limited to 'Doc/library/py_compile.rst')
-rw-r--r-- | Doc/library/py_compile.rst | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/Doc/library/py_compile.rst b/Doc/library/py_compile.rst index c6eea84..b5b9010 100644 --- a/Doc/library/py_compile.rst +++ b/Doc/library/py_compile.rst @@ -22,7 +22,7 @@ byte-code cache files in the directory containing the source code. Exception raised when an error occurs while attempting to compile the file. -.. function:: compile(file, cfile=None, dfile=None, doraise=False) +.. function:: compile(file, cfile=None, dfile=None, doraise=False, optimize=-1) Compile a source file to byte-code and write out the byte-code cache file. The source code is loaded from the file name *file*. The byte-code is written to @@ -37,6 +37,13 @@ byte-code cache files in the directory containing the source code. returns the path to byte-compiled file, i.e. whatever *cfile* value was used. + *optimize* controls the optimization level and is passed to the built-in + :func:`compile` function. The default of ``-1`` selects the optimization + level of the current interpreter. + + .. versionchanged:: 3.2 + Added the *optimize* parameter. + .. function:: main(args=None) |