[Python-Dev] Inconsistent behaviour in import/zipimport hooks

Guido van Rossum guido at python.org
Fri Nov 11 17:15:18 CET 2005

On 11/11/05, Ulrich Berning <ulrich.berning at desys.de> wrote:
> Guido, if it was intentional to separate slightly different generated
> bytecode into different files and if you have good reasons for doing
> this, why have I never seen a .pyoo file :-)

Because -OO was an afterthought and not implemented by me.

> For instance, nobody would give the output of a C compiler a different
> extension when different compiler flags are used.

But the usage is completely different. With C you explicitly manage
when compilation happens. With Python you don't. When you first run
your program with -O but it crashes, and then you run it again without
-O to enable assertions, you would be very unhappy if the bytecode
cached in a .pyo file would be reused!

> I would appreciate to see the generation of .pyo files completely
> removed in the next release.

You seem to forget the realities of backwards compatibility. While
there are ways to cache bytecode without having multiple extensions,
we probably can't do that until Python 3.0.

--Guido van Rossum (home page: http://www.python.org/~guido/)

More information about the Python-Dev mailing list