__pycache__, one more good reason to stck with Python 2?

Terry Reedy tjreedy at udel.edu
Mon Jan 17 18:18:36 EST 2011


No. The benefit of, for instance, not adding 200 .pyc files to a 
directory with 200 .py files is immediately obvious to most people.

On 1/17/2011 1:17 PM, jmfauth wrote:
>> No, I'm sorry, they're not obvious at all.

> These reasons become obious as soon as you start working.
>
> Let's take a practical point view. It did not take a long time
> to understand, that it is much simpler to delete the __pycache__
> directory everytime I compile my scripts than to visit it just
> because I deleted or renamed a .py file in my working directory.

Deleting the subdirectory is as least as easy as searching through the 
directory to find one or more files. In any case, the obsolete misnamed 
.pyc files hurt very little. Delete once a year or so if the space is an 
issue.

In 13 years, I have hardly ever worried about deleting .pyc files.

> How long will it take to find on the web tools to parse and
> delete ophan .pyc files on a hd?
>
> If I get (stupidly, I agree) a .pyc file and want to test
> it. Should I create manually a cache alongside my test.py
> script?

Since this is stupid (your word), it should be rare ;-).
Since it can be dangerous, it should be more difficult.
If you get a zip or tar file from a trusted source,
get the .__cache__ dir with the file.

> If I wish to delete the numerous auxiliary files a TeX
> document produces, I just del /rm .* to keep a clean working
> dir. With Python now? Impossible! The files are spread in two
> dirs (at least).

I do not know what TeX has to do with Python.
-- 
Terry Jan Reedy




More information about the Python-list mailing list