[Python-Dev] __pycache__ creation

Barry Warsaw barry at python.org
Wed Mar 24 13:09:37 CET 2010


On Mar 23, 2010, at 08:42 PM, Ron Adam wrote:

>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.

Not quite.  In PEP-3147-land, you do not need to create the empty __pycache__
directory, Python will create it for you on-demand.  If you subsequently move
the .py source file, the __pycache__/...pyc file will be ignored.  So this is
actually better than today because you can't accidentally load stale pyc files
-- if they live inside __pycache__.   For backward compatibility we'll still
support loading lone pyc files in the source file directory (i.e. outside of
__pycache__).

-Barry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-dev/attachments/20100324/70337bb7/attachment.pgp>


More information about the Python-Dev mailing list