[Python-Dev] __pycache__ creation
Ron Adam
rrr at ronadam.com
Tue Mar 23 01:53:28 CET 2010
Barry Warsaw wrote:
> On Mar 22, 2010, at 02:02 PM, Ron Adam wrote:
>
>> If I understand correctly, we would have the current mode as the default, and
>> can trigger __pycache__ behavior simply by manually creating a __pycache__
>> directory and deleting any byte-code files in the module/program directory.
>>
>> I like this, it is easy to understand and can be used without messing with
>> flags or environment variables.
>
> Well, for a package with subpackages, it gets more complicated. Definitely
> not something you're likely to do manually. Antoine's suggestion of 'python
> -m compileall --pycache' would work, but I think it's also obscure enough that
> most Python users won't get the benefit.
May be a bit more complicated, but it should be easy to write tools to
handle the repetitive stuff.
When I'm writing python projects I usually only work on one or two packages
at a time at most. Creating a couple of directories when I first get
started on a project is nothing compared with the other 10 or more files of
> 1,000 lines of code each. This has a very low mental hurdle too.
All the other packages I'm importing would probably already be preinstalled
complete with __pycache__ directories and bytecode files. As Antoine was
suggesting that it would be up to the installer's (scrips) to create the
__pycache__ directories at install time, either directly or by possibly
issuing a 'python -m compileall --pycache' command?
Ron
More information about the Python-Dev
mailing list