.pyc vs. .pyo

3 thoughts on “.pyc vs. .pyo

  1. Hi all


    I have noticed that PythonWin (I do not know its version, but Help -> About says "build 143") produces two types of object code files.


    By pressing F6 you will get .pyc and by mouse right click ->Compile you will get .pyo extended files.


    The difference between the contents is minor, but please explain the reason for having these two types.


    I could not find any reference to .pyc in the latest Python manual (Telit_Easy_Script_Python_r13). 


    Best regards,


    1. Hi Tom, sorry for the delay; .pyo files are optimized versions of .pyc files, compiled with switch -o but basically not very much optimizations happens that is why you don’t see many differences.

      See here and here for more details.