doc strings should not be accessed? -OO

G

George Young

[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...
 
T

Thomas Heller

George Young said:
[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...

The *sole purpose* of '-OO' against '-O' is to remove the doc strings.
You should not give any switches to Python when you're not knowing what
they do...

Thomas
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,178
Messages
2,570,955
Members
47,509
Latest member
Jack116

Latest Threads

Top