스핑크스에서는 선언과 함께 매개 변수를 문서화하는 방법이 있습니까?
를 적용하기 위해 매개 변수를 선언하는 동일한 줄에 각 매개 변수를 문서화하는 것을 선호합니다. 다음과 같은 코드가있는 경우 :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.]
파이썬 2.6이나 파이썬 3에서 가능한 일종의 데코레이터 조작입니까? 다른 방법이 있습니까?
RST가 충분히 깨끗하다면 (스핑크스의'param'은 실제로 도움이되지 않습니다.) 함수 정의를 살펴보고 docstring으로 내려가는 것이 쉬워야합니다. 나는 기본 스핑크스 스타일 ('param's)을 사용하지 않고 코드에서 훨씬 더 * 잘 보이고 렌더링되었을 때 여전히 괜찮은 Google 스타일로 간다. ([이 질문] (http://stackoverflow.com/a)/11176267/194586)은 두 가지 장점을 모두 누리는 것에 대해 이야기합니다. –