views:

181

answers:

2

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 example of how to document a **kwargs parameter.

Does anyone have a good example of a clear way to document these?

+3  A: 

I think subprocess-module's docs is a good example. Give an exhaustive list of all parameters for a top/parent class. Then just refer to that list for all other occurrences of **kwargs.

SilentGhost
Probably the best example I found in the end too. Thanks very much.
jkp
A: 

Well, **kwargs is used if you don't know what arguments you are going to get (and don't care), so there isn't that much to document.

Edit: Apparently you didn't mean **kwargs when he said **kwargs, but only means normal keyword arguments.

I would document them by simply listing them, explaining what they are there for, and what they default to.

Lennart Regebro
Not true: you may just be allowing a long series of arguments but not want explicitly ordered or specified.
jkp
Then you don't need to use the ** syntax, which your question explicitly uses. Standard keyword arguments can be specified in any order or skipped.
Lennart Regebro