Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
プログラムで追加の関数が書き込まれるモジュールがあります。 すなわち:
def fun1(): # function written on 27.02.13 ... def fun2(): # function written on 28.02.13 ...
ファイルを変更せずに、実行時にモジュール自体とこれらの関数にdocstringを追加したいと思います。
これは別のスクリプトを介して行うことができますか?
__doc__モジュールに属性を追加するだけです。
__doc__
import foo foo.__doc__ = '''My docstring for this module'''