By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,345 Members | 1,783 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,345 IT Pros & Developers. It's quick & easy.

doc strings should not be accessed? -OO

P: n/a
[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 wh*@ll.mit.edu
[three letter username]

Jul 18 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
George Young <ge*********@ll.mit.edu> writes:
[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
Jul 18 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.