do we need .pyo files?

Tom "spot" Callaway tcallawa at
Mon Apr 16 16:32:20 UTC 2007

I'm admittedly not a low-level python guru, but I think its worth asking
the question: Do we need .pyo files in our python packages?

Guido's book "An Introduction to Python" seems to imply that optimized
python files are pretty useless.

Currently, brp-python-bytecompile generates both normal (.pyc) and
optimized (.pyo) byte-compiled files.

The .pyo files are generated with:
python -O -c ...

The book says:
"The optimizer currently doesn't help much; it only removes assert
statements. When -O is used, all bytecode is optimized; .pyc files are
ignored and .py files are compiled to optimized bytecode."

Recently, it was noticed that the .pyo files are almost always identical
to the .pyc files, and it was suggested that the two be hardlinked
together to save space. Would it be more prudent to just stop
generating .pyo files altogether?

Note: I'm not pushing for this change to happen in F-7, far too late in
the cycle for that, but if there is merit to it, we should consider it
for F-8.

Thanks in advance,


More information about the fedora-devel-list mailing list