Make the current proposed solution explicit.

Use Python 2.6 to create the PEPs.
This commit is contained in:
Barry Warsaw 2010-03-24 12:32:09 +00:00
parent ceadcf5f92
commit 0db50c5cd6
2 changed files with 27 additions and 1 deletions

View File

@ -5,7 +5,7 @@
PEP2HTML=pep2html.py
PYTHON=python2.5
PYTHON=python2.6
.SUFFIXES: .txt .html

View File

@ -108,6 +108,32 @@ compiled cache files to co-exist for a single Python source file.
This scheme has the added benefit of reducing the clutter in a Python
package directory.
When a Python source file is imported for the first time, a
`__pycache__` directory will be created in the package directory, if
one does not already exist. The pyc file for the imported source will
be written to the `__pycache__` directory, using the magic-tag
formatted name. If either the creation of the `__pycache__` directory
or the pyc file inside that fails, the import will still succeed, just
as it does in a pre-PEP-3147 world.
If the py source file is missing, the pyc file inside `__pycache__`
will be ignored. This eliminates the problem of accidental stale pyc
file imports.
For backward compatibility, Python will still support pyc-only
distributions, however it will only do so when the pyc file lives in
the directory where the py file *would* have been, i.e. not in the
`__pycache__` directory. pyc file outside of `__pycache__` will only
be imported if the py source file is missing.
Tools such as `py_compile` [15]_ and `compileall` [16]_ will be
extended to create PEP 3147 formatted layouts automatically, but will
have an option to create pyc-only distribution layouts.
Examples
---------
What would this look like in practice?
Let's say we have a Python package named `alpha` which contains a