[Python-Dev] PEP 3147: PYC Repository Directories

Glenn Linderman v+python at g.nevcal.com
Thu Feb 4 22:38:26 CET 2010


On approximately 1/30/2010 4:00 PM, came the following characters from 
the keyboard of Barry Warsaw:
> When the Python executable is given a `-R` flag, or the environment
> variable `$PYTHONPYR` is set, then Python will create a `foo.pyr`
> directory and write a `pyc` file to that directory with the hexlified
> magic number as the base name.
>    

After the discussion so far, my opinion is that if the source directory 
contains an appropriate python repositiory directory [1], and the 
version of Python implements PEP 3147, that there should be no need for 
-R or $PYTHONPYR to exist, but that such versions of Python would 
simply, and always look in the python repository directory for binaries.

I've reached this conclusion for several reasons/benefits:

1) it makes the rules simpler for people finding the binaries
2) there is no "double lookup" to find a binary at run time
3) if the PEP changes to implement alternatives B or C in [1], then I 
hear a large consensus of people that like that behavior, to clean up 
the annoying clutter of .pyc files mixed with source.
4) There is no need to add or document the command line option or 
environment variable.



[1] Alternative A... source-file-root.pyr, as in the PEP, Alt. B... 
source-file-dir/__pyr__ all versions/files in same lookaside directory, 
Alt. C... source-file-dir/__pyr_version__, each Python version with 
different bytecode would have some sort of version string or magic 
number that identifies it, and would look only in that directory for its 
.pyc/.pyo files.  I prefer C for 4 reasons: 1) easier to blow away one 
version; 2) easier to see what that version has compiled; 3) most people 
use only one or two versions, so directory proliferation is limited; 4) 
even when there are 30 versions of Python, the subdirectories would 
contain the same order-of-magnitude count of files as the source 
directory for performance issues, if the file system has a knee in the 
performance curve as some do.

-- 
Glenn -- http://nevcal.com/
===========================
A protocol is complete when there is nothing left to remove.
-- Stuart Cheshire, Apple Computer, regarding Zero Configuration Networking



More information about the Python-Dev mailing list