packages containing collection of modules built-in modules written in and linked into the python interpreter when looking for module (for examplefoo)the interpreter searches each of the directories in sys path for the following files (listed in search order) directoryfoodefining package foo pydfoo sofoomodule soor foomodule dll (compiled extensions foo pyo (only if the - or -oo option has been used foo pyc foo py (on windowspython also checks for pyw files packages are described shortlycompiled extensions are described in "extending and embedding python for py fileswhen module is first importedit' compiled into bytecode and written back to disk as pyc file on subsequent importsthe interpreter loads this precompiled bytecode unless the modification date of the py file is more recent (in which casethe pyc file is regeneratedpyo files are used in conjunction with the interpreter' - option these files contain bytecode stripped of line numbersassertionsand other debugging information as resultthey're somewhat smaller and allow the interpreter to run slightly faster if the -oo option is specified instead of -odocumentation strings are also stripped from the file this removal of documentation strings occurs only when pyo files are created--not when they're loaded if none of these files exists in any of the directories in sys paththe interpreter checks whether the name corresponds to built-in module name if no match existsan importerror exception is raised the automatic compilation of files into pyc and pyo files occurs only in conjunction with the import statement programs specified on the command line or standard input don' produce such files in additionthese files aren' created if the directory containing module' py file doesn' allow writing ( either due to insufficient permission or if it' part of zip archivethe - option to the interpreter also disables the generation of these files if pyc and pyo files are availableit is not necessary for corresponding py file to exist thusif you are packaging code and don' wish to include sourceyou can merely bundle set of pyc files together howeverbe aware that python has extensive support for introspection and disassembly knowledgeable users will still be able to inspect and find out lot of details about your program even if the source hasn' been provided alsobe aware that pyc files tend to be version-specific thusa pyc file generated for one version of python might not work in future release when import searches for filesit matches filenames in case-sensitive manner-even on machines where the underlying file system is case-insensitivesuch as on windows and os (such systems are case-preservinghoweverthereforeimport foo will only import the file foo py and not the file foo py howeveras general ruleyou should avoid the use of module names that differ in case only lib fl ff