[Python-Dev] Inconsistent behaviour in import/zipimport hooks
osantana at gmail.com
Wed Nov 9 19:15:04 CET 2005
On 11/9/05, Guido van Rossum <guido at python.org> wrote:
> 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?
I agree with this idea, but we've to think about docstrings (like
Nicola said in his e-mail).
Maybe we want to create a different and optimization-independent
option to remove docstrings from modules?
> 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.
I've other use case: I'm porting Python to Maemo Platform and I want
to reduce the size of modules. The .pyo (-OO) are smaller than .pyc
files (mainly because docstring removing) and we start to use this
optimization flag to compile our Python distribution.
In this case we want to force developers to call Python Interpreter
with -O flags, set PYTHONOPTIMIZE, or apply my patch :) to make this
I've noticed this inconsistency when we stop to use zipimport in our
Python For Maemo distribution. We've decided to stop using zipimport
because the device (Nokia 770) uses a compressed filesystem.
Some friends (mainly Gustavo Barbieri) help me to create the suggested
patch after some discussion in our PythonBrasil mailing list.
Osvaldo Santana Neto (aCiDBaSe)
icq, url = (11287184, "http://www.pythonbrasil.com.br")
More information about the Python-Dev