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

Brett Cannon brett at python.org
Sat Nov 4 21:40:23 CET 2006


On 11/4/06, Osvaldo Santana <osantana at gmail.com> wrote:
>
> 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


The other option is to do away with .pyo files:
http://www.python.org/dev/summary/2005-11-01_2005-11-15/#importing-pyc-and-pyo-files

Guido has said he wouldn't mind it, but then .pyc files need to grow a field
or so to be able to store what optimizations were used.  While this would
lead to more bytecode regeneration, it would help deal with this case and
allow for more optimizations on the bytecode.

-Brett


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
> _______________________________________________
> 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/brett%40python.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/python-dev/attachments/20061104/5347f0af/attachment.htm 


More information about the Python-Dev mailing list