Two questions

John Machin sjmachin at lexicon.net
Thu Jun 2 16:50:25 EDT 2005


Steven D'Aprano wrote:
> On Thu, 02 Jun 2005 06:45:18 -0700, qscomputing wrote:
> 
>>2. Philospohy(sp?) aside, 
> 
> 
> Philosophy.
> 
> 
>>I could potentially want to create a
>>binary-only distribution of my finished apps. I noticed the
>>documentation on .pyc files: how do I create these 
> 
> 
> In PythonCard? I have no idea. Sorry.
> 
> In ordinary Python?
> 
> When you run or import a Python module, the Python interpreter first looks
> for a .pyc file of the same name that is more recent than the .py file. If
> it doesn't find one, it compiles the .py file into byte-code, stores the
> byte-code in the .pyc file, and runs that.
> 
> In other words, to create your .pyc file, just run your .py file and
> Python will do it automatically.
> 

The notion that just running a .py file will create a .pyc file is 
contrary to widely-held belief, and (admittedly small, but very recent, 
on Python 2.4.1, in a directory to which I have and had write access) 
empirical evidence. I can't be bothered checking *all* sightings of the 
time machine but my copy of 1.5.2 exhibits the same behaviour.

Is it possible that you could be mistaken?



More information about the Python-list mailing list