[Python-Dev] __file__

Barry Warsaw barry at python.org
Tue Mar 2 01:41:52 CET 2010


On Feb 28, 2010, at 02:51 PM, Greg Ewing wrote:

>A solution might be to look for the presence of the
>cache directory, and only look for a .pyc in the source
>directory if there is no cache directory. Testing for
>the cache directory would only have to be done once
>per package and the result remembered, so it would
>add very little overhead.

I think the other thing that bothers me about continuing to support pyc-only
imports, is that people will then want tools to create them.  Right now, it's
probably just as easy as byte-compiling everything, then finding the .py files
and removing them.

After PEP 3147 is implemented, and the default, you'll have to byte-compile
the files, then find the pycs in the __pycache__ directory, move them up a
level and rename them.  Then of course remove the .py files.

It's not insurmountable of course, I think if we support pyc-only imports,
people are rightly going to want us to write and support the tool to create
those imports.

-Barry

-------------- 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/20100301/75dc922a/attachment.pgp>


More information about the Python-Dev mailing list