[Python-Dev] Importing .pyc in -O mode and vice versa

Osvaldo Santana osantana at gmail.com
Sat Nov 4 20:38:52 CET 2006


Hi,

I'm the author of this patch and we are already using it in Python
port for Maemo platform.

We are using .pyo modules mainly to remove docstrings from the
modules. We've discussed about this patch here[1] before.

Now, I agree that the zipimport behaviour is incorrect but I don't
have other option to remove docstrings of a .pyc file.

I'm planning to send a patch that adds a "--remove-docs" to the Python
interpreter to replace the "-OO" option that create only .pyo files.

[1] http://mail.python.org/pipermail/python-dev/2005-November/057959.html

On 11/4/06, "Martin v. Löwis" <martin at v.loewis.de> wrote:
> Fredrik Lundh schrieb:
> >> However, I find the proposed behaviour reasonable: Python already
> >> automatically imports the .pyc file if .py is not given and vice
> >> versa. So why not look for .pyo if the .pyc file is not present?
> >
> > well, from a performance perspective, it would be nice if Python looked
> > for *fewer* things, not more things.
>
> That's true.
[cut]

-- 
Osvaldo Santana Neto (aCiDBaSe)
http://www.pythonologia.org


More information about the Python-Dev mailing list