redundant importr
max(01)*
max2 at fisso.casa
Sat Apr 2 10:43:07 EST 2005
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:
max2 at 172.17.1.201:~/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
max2 at 172.17.1.201:~/tmp/import-enigma$ cat importer.py
import imported
imported.fun_1()
max2 at 172.17.1.201:~/tmp/import-enigma$ cat imported.py
def fun_1():
print "I am fun_1()"
max2 at 172.17.1.201:~/tmp/import-enigma$ python importer.py
I am fun_1()
max2 at 172.17.1.201:~/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
max2 at 172.17.1.201:~/tmp/import-enigma$
see?
bye
macs
More information about the Python-list
mailing list