What is the correct way to document a **kwargs parameter?

后端 未结 8 1014
清酒与你
清酒与你 2021-01-30 02:48

I\'m using sphinx and the autodoc plugin to generate API documentation for my Python modules. Whilst I can see how to nicely document specific parameters, I cannot find an exam

8条回答
  •  悲&欢浪女
    2021-01-30 03:18

    I am unable to find the actual link to the docs but this works (using Sphinx 3.4.3):

    class Foo:
        """A Foo implementation
    
        :param str foo: Foo
        :param int bar: Bar
        :keyword str key1: kwarg 1
        :keyword str key2: kwarg 2
        :keyword int key3: kwarg 3
        """
    
        def __init__(self, foo, bar, **kwargs):
            pass
    

提交回复
热议问题