473,320 Members | 1,977 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

doc strings should not be accessed? -OO

[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
1 1226
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: JKop | last post by:
Let's say you have a global const variable for the name of your application. Which do you think is preferrable?: A) char const g_application_name = "ChocolateCheese"; B) const char* const...
36
by: raphfrk | last post by:
I have the following code: char buf; printf("%lp\n", buf); printf("%lp\n", &buf); printf("%lp\n", buf); printf("%lp\n", buf); printf("%d\n", buf-buf);
10
by: Chung Leong | last post by:
Just saw a message in pl.comp.lang.php, which states that the following message has appeared in the PHP CVS snapshot: Usage of {} to access string offsets is deprecated and will be removed in...
4
by: Matt Colegrove | last post by:
I'm working on a web app that is published to a hosting service. I'm developing it on my local PC with VS 2005 and SQL Express. The hosting service DB is SQL Server 2000. I have two...
12
by: romayankin | last post by:
I plan to write site on a few language. For this reason I'm trying to find the most convenient way to output strings depending on their unique ID. As far as I plan to have pretty much strings...
4
by: nass | last post by:
hello everyone, i have a bit of problem reading char * strings from a buffer (a shared memory, pointed to by 'file_memory'). basically i have a structure in memory 'ShMem' that can be accessed by...
4
by: carry | last post by:
Hi everybody, I need simple string formatting like string.Format() does, but just with strings what seems not to work. Can anyone tell me please why this doesn't work and how can it be done? This...
8
by: bintom | last post by:
What are the differences between the following methods of declaring strings? char string1 = "C++ forum"; char* string2 = "C++ forum"; I know that the first uses the array notation, whereas...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.