[Python-Dev] PEP 3147: PYC Repository Directories

Barry Warsaw barry at python.org
Sun Feb 7 19:22:36 CET 2010

On Feb 01, 2010, at 08:26 AM, Tim Delaney wrote:

>The pyc/pyo files are just an optimisation detail, and are essentially
>temporary. Given that, if they were to live in a single directory, to me it
>seems obvious that the default location for that should be in the system
>temporary directory. I an immediately think of the following advantages:
>1. No one really complains too much about putting things in /tmp unless it
>starts taking up too much space. In which case they delete it and if it gets
>reused, it gets recreated.

IIUC the Filesystem Hierarchy Standard correctly, then these files really
should go under /var/cache/python.  (Don't ask me where that would be on
non-FHS compliant systems <cough>Windows</cough>).  I've explained in other
followups why I don't particularly like separating the source from the cache
files though, but if you wanted a sick approach:

Take the full absolutely path to the .py file, plus the magic number, plus the
time stamp and hash that.  Cache the pyc file under /var/cache/python/<hash>.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 835 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-dev/attachments/20100207/080ed1b1/attachment.pgp>

More information about the Python-Dev mailing list