> 3. In each top level directory on sys.path, shadow file heirarchy
>   Major Pro: trivial to separate out all cached files
>   Major Con: ??? (I got nuthin')

The major con of this option (and option 2) is an ambiguity of where to
look for in case of packages. In particular for namespace packages
(of the setuptools kind, or the PEP 382 kind), the directory where a
package is found on sys.path can change across Python runs.

So when you run Python several times, and install additional eggs
in-between, you get different directories all caching the same pyc
files. If you then uninstall some of the eggs, it may be difficult to
find out what pyc files to delete.

> Note that with option two, creating a bytecode only zipfile would be
> trivial: just add the __pycache__ directory as the top-level directory
> in the zipfile and leave out everything else (assume there were no data
> files in the package that were still needed).

I think any scheme that uses directories for pyc files will cause stale
pyc files to be located on disk. I then think it is important to never
automatically use these in imports - i.e. only ever consider a file in
a __pycache__ directory if you found a .py file earlier.

If that is the policy, then a __pycache__ directory in a zipfile would
have no effect (and rightly so). Instead, to run code from bytecode,
the byte code files should be on sys.path themselves (probably still
named the same way as they are named inside __pycache__).

Regards,
Martin
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to