On Fri, 04 Nov 2011 16:01:14 -0400, Terry Reedy wrote: > For those not aware, the compiled file caching and import system was > changed for 3.2. Given test.py, the compiled file is no longer test.pyc, > in the same directory, but (for cpython32) > __pycache__/test.cpython-32.pyc. Given the statement 'import test', the > __pycache__ directory is only searched (for the name given above) after > finding test.py. So if 'test.py' is deleted or renamed to 'mytest.py', > an unchanged 'import test' will *fail* instead of importing the obsolete > .pyc file. So there is no longer a functional reason to delete such > obsolete files. However, the OP is stuck with 2.5.
Oh, I don't know, removing obsolete and useless crud from your file system seems like a good enough functional reason to me :) However, the behaviour of Python 3.2 is a little more complicated than the above, since it must still support .pyc only software. If you have a .pyc file in the PYTHONPATH, but *outside* of a __pycache__ directory, and it is compiled for the correct version of Python, it will still be imported as usual. I'm not sure what happens if you have two .pyc files, one inside the cache and one outside. -- Steven -- http://mail.python.org/mailman/listinfo/python-list