<< Back to man.ChinaUnix.net

A Byte of Python

Byte-compiled .pyc files

Importing a module is a relatively costly affair, so Python does some tricks to make it faster. One way is to create byte-compiled files with the extension .pyc which is related to the intermediate form that Python transforms the program into (remember the intro section on how Python works ?). This .pyc file is useful when you import the module the next time from a different program - it will be much faster since part of the processing required in importing a module is already done. Also, these byte-compiled files are platform-independent. So, now you know what those .pyc files really are.