In Sphinx, is there a way to document parameters along with declaring them?

前端 未结 3 1708
礼貌的吻别
礼貌的吻别 2021-02-20 09:43

I prefer to document each parameter (as needed) on the same line where I declare the parameter in order to apply D.R.Y.

If I have code like this:

def foo         


        
3条回答
  •  难免孤独
    2021-02-20 09:52

    You can't do that without a preprocessor, as comments don't exist for Python once the source has been compiled. To avoid repeating yourself, remove the comments and document the parameters only in the docstring, this is the standard way to document your arguments.

提交回复
热议问题