2.7.2 ドキュメントのセクション 6 からModules
:
Passing two -O flags to the Python interpreter (-OO) will cause the bytecode compiler to perform optimizations that could in some rare cases result in malfunctioning programs. Currently only __doc__ strings are removed from the bytecode, resulting in more compact .pyo files.
これは私の注意を引きました:
Since some programs may rely on having these available, you should only use this option if you know what you’re doing.
構文エラーを無視して、スクリプトの docstring を削除すると、コードの機能の依存関係やその他の側面が論理的に壊れる可能性がある場合はありますか?
編集
コメントを削除するとヘルプ ステートメントが壊れるのはなぜですか? インタプリタではそうではないようです。
>>> help('import_pi')
Help on module import_pi:
NAME
import_pi
FILE
/home/droogans/py/import_pi.py
FUNCTIONS
print_pi()
DATA
pi = 3.1415926535897931
>>> import import_pi()
>>> import_pi.__doc__
>>>
>>> print import_pi.print_pi.__doc__
Convert a string or number to a floating point number, if possible.