、第6節、Modules
:ドキュメントストリングに依存するスクリプト? 2.7.2ドキュメントから
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.
は、スクリプトのドキュメンテーション文字列を削除する任意の場合があるのかもしれない論理的いくつかの依存関係やコードの機能の他の部分を壊し、構文上の誤りは無視しますか?
編集
コメントを削除するとヘルプステートメントが破損するのはなぜですか?それは通訳ではそう思わない。例えばplyについて
>>> 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.
ドキュメントストリングがスクリプトから削除されている部分を除きます。あるいは、私は両方のケースを誤解していますか? – Droogans
ああ、あなたが言っていることが分かります。はい、いいえ、「-OO」はバイトコードからそれを削除します。 '.py'ファイルは変更されませんが、あなたは正しいです。私は単に私の主題に関するいくつかの関連する質問の1つだったので、2つを単に関連させていました。私は通常、私の質問に私を導いたものと、最初のコメントはほとんどいつものようなものになって以来、私をそこに持っていた私の考えを書いています。 – Droogans