[Tutor] Mysterious .pyc

Daniel Yoo dyoo@hkn.eecs.berkeley.edu
Fri, 19 Jan 2001 00:26:15 -0800 (PST)


On Thu, 18 Jan 2001, Matthias Hager wrote:

> I'm learning python, and just read about functions. But whenever I
> call a function from another file, it creates a file. Say I import
> leap2
> 
> It creates a file called leap2.pyc Why is it doing that? The leap2.pyc
> has some unreadable junk in it, some of it looks sort of like what I
> had in leap2. What am I doing to make it do this? And how come I don't
> have to specify where Python is located on my system in a program?

About the .pyc stuff --- it's called "byte-compiled" code.  When you're
calling something from another file, Python will invest some time in
preprocessing the file, translating it into a form that it digests more
easily.  Usually, you can just ignore the .pyc files, since Python takes
care of it on the fly.

About Python being known... hmmm... well, isn't that a good thing?  
*grin* It's possible that Python's is in your system "path", that is, when
you request for Python, your system will automatically know where to look.