This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author JohnRoth1
Recipients JohnRoth1, docs@python, terry.reedy
Date 2012-02-04.02:27:59
SpamBayes Score 0.0
Marked as misclassified No
Message-id <1328322481.74.0.780663998328.issue13915@psf.upfronthosting.co.za>
In-reply-to
Content
I apologize for not submitting this in patch format, but I don't have a development system available.

I suggest replacing the entire 6.1.3 section with: 

To speed up loading modules, Python caches the compiled version of each module in the __pycache__ directory under the name module.cpython-xy.pyc, where xy is the Python version number. For example, in release 3.2 the compiled version of spam.py would be cached as __pycache__/spam.cpython-32.pyc. This naming convention allows compiled modules from different releases and different versions of Python to coexist.

Python checks the revision date of the source against the compiled version to see if it’s out of date and needs to be recompiled. This is a completely automatic process. Also, the compiled modules are platform-independent, so the same library can be shared among systems with different architectures.

Python does not check the cache in two circumstances. First, it always recompiles and does not store the result for the module that’s loaded directly from the command line. Second, it does not check the cache if there is no source module. To support a non-source (compiled only) distribution, the compiled module must be in the source directory, and there must not be a source module.

Some tips for experts:

* You can use the -O or -OO switches on the Python command to reduce the size of a compiled module. The -O switch removes assert statements, the -OO switch removes both assert statements and __doc__ strings. Neither optimization affects running time, however it’s possible that they may affect run-time behavior. Optimized modules have a .pyo rather than a .pyc suffix. Future releases may change the effects of optimization.

*   The module compileall can create .pyc files (or .pyo files when -O is used) for all modules in a directory.

*   There is more detail on this process, including a flow chart of the decisions, in PEP 3147.
History
Date User Action Args
2012-02-04 02:28:01JohnRoth1setrecipients: + JohnRoth1, terry.reedy, docs@python
2012-02-04 02:28:01JohnRoth1setmessageid: <1328322481.74.0.780663998328.issue13915@psf.upfronthosting.co.za>
2012-02-04 02:28:01JohnRoth1linkissue13915 messages
2012-02-04 02:27:59JohnRoth1create