doc strings and efficiency

Thomas Heller thomas.heller at ion-tof.com
Tue Oct 2 08:55:38 EDT 2001


>     Documentation strings, as they are available at runtime, increase the
> memory requirement of the running python process. Currently, I have memory to
> burn in the environments that I code on, but if I want to use Python in an
> environment where memory is very tight, I find myself suddenly wondering if I
> should use docstrings.
>     I'd like to, as they are a great feature of the language, but a "would be
> nice" feature in the interpreter would be an option to ignore them, so that
> under tight conditions I could shut them off, but still have them in the
> source code for debugging on boxes where I'm not under those tight
> restrictions.
>     Does anyone know of any plans for such a feature? Any counter-arguments
> for why this would not be necessary?

The time machine strikes again:

python -h prints (among other stuff):

-O     : optimize generated bytecode (a tad; also PYTHONOPTIMIZE=x)
-OO    : remove doc-strings in addition to the -O optimizations

Thomas






More information about the Python-list mailing list