DRYを適用するために、パラメーターを宣言するのと同じ行に(必要に応じて)各パラメーターを文書化することを好みます
私がこのようなコードを持っている場合:
def foo(
flab_nickers, # a series of under garments to process
has_polka_dots=False,
needs_pressing=False # Whether the list of garments should all be pressed
):
...
doc文字列でパラメーターを繰り返さないようにし、パラメーターの説明を保持するにはどうすればよいですか?
避けたい:
def foo(
flab_nickers, # a series of under garments to process
has_polka_dots=False,
needs_pressing=False # Whether the list of garments should all be pressed
):
'''Foo does whatever.
* flab_nickers - a series of under garments to process
* needs_pressing - Whether the list of garments should all be pressed.
[Default False.]
これは、Python2.6またはPython3で、ある種のデコレータ操作を使用して可能ですか?他に方法はありますか?