at every subsequent import of the module python will detect that the module has already been imported and will do nothing when python needs module' byte-code compiled codeit generates it automatically--this differs fromsayjavawhere compiling to byte code must be done explicitly first python looks for file with the same name as the module' py file but with the extension pyo--this is an optimized byte-code compiled version of the module if there is no pyo file (or if it is older than the py filethat isif it is out of date)python looks for file with the extension pyc--this is nonoptimized byte-code compiled version of the module if python finds an up-to-date byte-code compiled version of the moduleit loads itotherwisepython loads the py file and compiles byte-code compiled version either waypython ends up with the module in memory in byte-code compiled form if python had to byte-compile the py fileit saves pyc version (or pyo if - was specified on python' command lineor is set in the pythonoptimize environment variable)providing the directory is writable saving the byte code can be avoided by using the - command-line optionor by setting the pythondontwritebytecode environment variable using byte-code compiled files leads to faster start-up times since the interpreter only has to load and run the coderather than loadcompile(save if possible)and run the coderuntimes are not affectedthough when python is installedthe standard library modules are usually byte-code compiled as part of the installation process packages | package is simply directory that contains set of modules and file called __init__ py supposefor examplethat we had fictitious set of module files for reading and writing various graphics file formatssuch as bmp pyjpeg pypng pytiff pyand xpm pyall of which provided the functions load()save()and so on we could keep the modules in the same directory as our programbut for large program that uses scores of custom modules the graphics modules will be dispersed by putting them in their own subdirectorysaygraphicsthey can be kept together and if we put an empty __init__ py file in the graphics directory along with themthe directory will become packagegraphics__init__ py bmp py jpeg py extensive support for handling graphics files is provided by variety of third-party modulesmost notably the python imaging library (www pythonware com/products/pil