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

Guido van Rossum guido at python.org
Wed Nov 9 16:39:29 CET 2005

Maybe it makes more sense to deprecate .pyo altogether and instead
have a post-load optimizer optimize .pyc files according to the
current optimization settings?

Unless others are interested in this nothing will happen.

I've never heard of a third party making their code available only as
.pyo, so the use case for changing things isn't very strong. In fact
the only use cases I know for not making .py available are in
situations where a proprietary "canned" application is distributed to
end users who have no intention or need to ever add to the code.


On 11/9/05, Osvaldo Santana <osantana at gmail.com> wrote:
> On 11/9/05, Guido van Rossum <guido at python.org> wrote:
> > You didn't show us what's in the zip file.  Can you show a zipinfo output?
> $ zipinfo modules.zip
> Archive:  modules.zip   426 bytes   2 files
> -rw-r--r--  2.3 unx      109 bx defN 31-Oct-05 14:49 module_o.pyo
> -rw-r--r--  2.3 unx      109 bx defN 31-Oct-05 14:48 module_c.pyc
> 2 files, 218 bytes uncompressed, 136 bytes compressed:  37.6%
> > My intention with import was always that without -O, *.pyo files are
> > entirely ignored; and with -O, *.pyc files are entirely ignored.
> >
> > It sounds like you're saying that you want to change this so that .pyc
> > and .pyo are always honored (with .pyc preferred if -O is not present
> > and .pyo preferred if -O is present). I'm not sure that I like that
> > better. If that's how zipimport works, I think it's broken!
> Yes, this is how zipimport works and I think this is good in cases
> where a third-party binary module/package is available only with .pyo
> files and others only with .pyc files (without .py source files, of
> course).
> I know we can rename the files, but this is a good solution? Well, I
> don't have a strong opinion about the solution adopted and I really
> like to see other alternatives and opinions.
> Thanks,
> Osvaldo
> --
> Osvaldo Santana Neto (aCiDBaSe)
> icq, url = (11287184, "http://www.pythonbrasil.com.br")
> _______________________________________________
> Python-Dev mailing list
> Python-Dev at python.org
> http://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe: http://mail.python.org/mailman/options/python-dev/guido%40python.org

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

More information about the Python-Dev mailing list