redundant importr

Peter Hansen peter at engcorp.com
Fri Apr 1 16:22:43 EST 2005


max(01)* wrote:
> Peter Hansen wrote:
>> 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.
> 
> but the other files *are* compiled, right? 

Yes, definitely.  I did say that.

> so the initial question remains unanswered: 

No it doesn't.  I thought I was clear, but I can reword
it for you: the files are compiled *in-memory* and the
results are never written to disk.

 > *if* they are compiled, where are they put, if the
> corresponding *.py files are on a non-writeable directory?

They are not put anywhere.  Compilation is a process
by which the source is converted to executable bytecodes.
This says nothing about where either the source or the
compiled result resides.  The actual compilation works
on a long series of bytes in memory, and the result is
just another long series of bytes.  Nothing requires that
either of these things are even stored in a file.

Not sure what else I could say to make it clearer...

(I'm not misunderstanding you am I?  I get the feeling
we're not quite on the same page here.)
-Peter



More information about the Python-list mailing list