[Python-Dev] __pycache__ creation

Ron Adam rrr at ronadam.com
Wed Mar 24 02:42:44 CET 2010


Terry Reedy wrote:
> On 3/22/2010 2:15 PM, Antoine Pitrou wrote:
> 
>> What I am proposing is that the creation of __pycache__ /directories/ 
>> be put
>> outside of the core. It can be part of distutils, or of a separate 
>> module, or
>> delegated to third-party tools. It could even be as simple as
>> "python -m compileall --pycache", if someone implements it.
>>
>> Creation of the __pycache__ /contents/ (files inside the directory) 
>> would still
>> be part of core Python, but only if the directory exists and is 
>> writable by the
>> current process.
> 
> -1
> 
> If, as I have done several times recently, I create a directory and 
> insert an empty __init__.py and several real module.py files, I want the 
> .pycs to go into __pycache__ *automatically, by default, without me also 
> having to remember to create an empty __pycache__ *directory*, *each 
> time*.  Ugh.

I think I misunderstood this at first.

It looks like, while developing a python 3.2+ program, if you don't create 
an empty __pycache__ directory, everything will still work, you just won't 
get the .pyc files.  That can be a good thing during development because 
you also will not have any problems with old .pyc files hanging around if 
you move or rename files.

The startup time may just be a tad longer, but probably not enough to be 
much of a problem.  If it is a problem you can just create the __pycache__ 
directory, but nothing bad will happen if you don't.

Ron







More information about the Python-Dev mailing list