**NEWBIE - QUESTION**

Matt Goodall matt at pollenation.net
Tue Oct 28 13:25:42 EST 2003


Jay Dorsey wrote:

> Staven Bruce wrote:
>
>> I am new to Python and am trying to use the Python-2.3.2-1Interperter on
>> Windows. I have a .py file and I am trying to compile it into a .pyc 
>> file.
>> When I began experimenting with Python, I could have sworn that 
>> opening the
>> .py file in IDLE, modifying it, and then saving it would automatically
>> create the corresponding .pyc file. But this is not working.
>
Out of interest, why are you trying to compile the module? This is 
generally not something you need to worry about.

>
> I believe you have to *run* the file to get it to compile, not just 
> save it.

Actually, Python only compiles modules that are imported, e.g.

    python file.py

would not compile it, whereas

    $ python
    >>> import file.py
    >>>

would compile it.

Cheers, Matt

-- 
Matt Goodall, Pollenation Internet Ltd
w: http://www.pollenation.net
e: matt at pollenation.net







More information about the Python-list mailing list