redundant imports

max(01)* max2 at fisso.casa
Fri Apr 1 14:32:00 EST 2005


Peter Hansen wrote:
> max(01)* wrote:
> 
>> this leads me to another question. since *.pyc files are automatically 
>> created the first time an import statement in executed on a given 
>> module, i guess that if i ship a program with modules for use in a 
>> directory where the user has no write privileges then i must ship the 
>> *.pyc files along too. right?
> 
> 
> Not required except for performance reasons.  If the .pyc
> files don't exist, the .py files are recompiled and the
> resulting bytecode is simply held in memory and not cached
> and the next startup will recompile all over again.
> 
> Note also that the main file (the one invoke from the
> command line) is never cached in a .pyc...

but the other files *are* compiled, right? so the initial question 
remains unanswered: *if* they are compiled, where are they put, if the 
corresponding *.py files are on a non-writeable directory?



More information about the Python-list mailing list