Peter Hansen wrote:
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.

ok, maybe it is an implementation-dependent issue after all.

i am working on a debian woody platform with the standard python2.3 package.

consider this:

[EMAIL PROTECTED]:~/tmp/import-enigma$ ll
total 8
-rw-r--r--    1 max2     max2           36 2005-04-02 17:44 imported.py
-rw-r--r--    1 max2     max2           33 2005-04-02 17:44 importer.py
[EMAIL PROTECTED]:~/tmp/import-enigma$ cat importer.py
import imported
imported.fun_1()
[EMAIL PROTECTED]:~/tmp/import-enigma$ cat imported.py
def fun_1():
  print "I am fun_1()"
[EMAIL PROTECTED]:~/tmp/import-enigma$ python importer.py
I am fun_1()
[EMAIL PROTECTED]:~/tmp/import-enigma$ ll
total 12
-rw-r--r--    1 max2     max2           36 2005-04-02 17:44 imported.py
-rw-r--r--    1 max2     max2          307 2005-04-02 17:45 imported.pyc
-rw-r--r--    1 max2     max2           33 2005-04-02 17:44 importer.py
[EMAIL PROTECTED]:~/tmp/import-enigma$

see?

bye

macs
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to