[Python-Dev] PEP 3147: PYC Repository Directories
Guido van Rossum
guido at python.org
Sun Feb 7 20:38:30 CET 2010
On Sun, Feb 7, 2010 at 10:17 AM, Barry Warsaw <barry at python.org> wrote:
> On Jan 31, 2010, at 11:34 PM, Nick Coghlan wrote:
>>I must admit I quite like the __pyr__ directory approach as well. Since
>>the interpreter knows the suffix it is looking for, names shouldn't
>>conflict. Using a single directory allows the name to be less cryptic,
>>too (e.g. __pycache__).
> Something else that occurs to me; the name of the directory (under
> folder-per-folder approach) probably ought to be the same as the name of the
> module attribute. There's probably no good reason to make it different, and
> making it the same makes the association stronger.
I'm not sure I follow. The directory doesn't suddenly become an
attribute. Moreover, the directory contains many files (assuming
folder-per-folder) and the attribute would point to a single file
inside that directory.
> That still gives us plenty of opportunity to bikeshed, but __pycache__ seems
> reasonable to me (it's the cache of parsing and compiling the .py file).
While technically it is a cache, I don't think that emphasizing that
point is helpful. For 20 years people have thought of it as "compiled
Also while on the filesystem it makes sense for it to have "py" in the
directory name, that does not make sense for the attribute name. After
all we don't go around calling things __pyfile__, __pygetattr__,
I'm still for __compiled__ as the attribute; I don't have a particular
preference for the directory name or the naming scheme used inside it,
as long as neither starts with '.' (and probably the directory should
--Guido van Rossum (python.org/~guido)
More information about the Python-Dev