[Tutor] Mysterious .pyc

alan.gauld@bt.com alan.gauld@bt.com
Fri, 19 Jan 2001 16:59:06 -0000

> import leap2
> It creates a file called leap2.pyc

As already explained Python does that each time you import 
a module for the first time.
On subsequent imports Python will use the .pyc file which 
makes the program run faster. Python is just trying to be 
helpful :-)

> Why is it doing that? The leap2.pyc has some unreadable junk 

Yeah, its for python to read not humans.

> And how come I don't have to specify where Python is located 
> on my system in a program?

Because the python installer set up your PATH environment variable
to point to where it installed Python. The same reason when you 
click on a document file you don't need to tell windows where your 
copy of MS Word is stored.

Alan g.