running python 2 vs 3

Terry Reedy tjreedy at udel.edu
Thu Mar 20 17:52:02 EDT 2014


On 3/20/2014 1:23 PM, notbob wrote:

> What the heck is a .pyc file and how are they created?

.pyc contained compiled bytecode. They are created when, and only when, 
you import a module.  Imported library files are often big and stable, 
so their compiled forms get cached. Top-level scripts are typically 
short and often volotile. They may be as short as "from start import 
run; run()" in order to have as much as possible stored in compiled form.

This has nothing to do with Idle.

> I went back to my ~/python/ dir and noticed one .pyc file out of 15
> .py files I created from following Learning Python the Hard Way.

That must be the only one you imported.

-- 
Terry Jan Reedy




More information about the Python-list mailing list