Why is it Convention to Repeat Function Signatures in Docstrings

You’re right that it is a pain to maintain, but it is hard to question the utility of having the function signature displayed as part of the docstring. It tells the reader how to call the function in a non-ambiguous way.

To help automate this tedious process, you can use

which essentially grabs the signature from the function definition itself.

8 Likes