doc strings should not be accessed? -OO

George Young gee_arr_why at ll.mit.edu
Tue Feb 10 14:37:05 EST 2004


[python 2.3.3, SuSE 8.2 x86 Linux]
In setting up an install procedure for the "released" directory
of my app, I found that after doing:

  python -OO -c 'import compileall;compileall.compile_dir(".")'

in my Makefile (I know, I'll switch to distutils sometime...),
my app doesn't print the proper "usage" message when invoked
with improper args.  The app is using the module's __doc__ 
string as part of it's "usage" message.  

I see from the docs that -OO or PYTHONOPTIMIZE=2 removes 
the __doc__ string.  It seems to me that either:

1) there should be clear and prominent warning where docstrings
are discussed in the manual that they may not be available
during execution, or

2) optimization should leave the poor things alone...

Coming from many years of c and c++ programming where "if 
cranking up the optimization changes the output, the compiler
is broken" -- it seems to violate the friendliness of python's
style...

-- 
George Young
gee arr why at ll.mit.edu
[three letter username]




More information about the Python-list mailing list