-2

I am writing documentation for my method which has many parameters, but all are just being directly passed into an API call. It will look something like this:

def func(a, b, c, d, e, f, g, h):
    api(a, b, c, d, e, f, g, h)

What should I put for my docstrings? The API's documentation is copywritten so I cannot just copy what they put for their parameters.

2 Answers2

0

The goal of the docstrings is to provide clear and helpful information to users of your code. By describing the purpose and usage of each parameter in your own words, you can ensure that your documentation is informative and compliant with copyright restrictions. eg-

def func(a, b, c, d, e, f, g, h):
"""
Calls the API with the provided parameters.
API's[docs](link)

Parameters:
- a (int): The first parameter representing X.
- b (str): The second parameter representing Y.
- c (float): The third parameter representing Z.
- d (bool): The fourth parameter representing whether to enable feature A.
- e (str): The fifth parameter representing the target endpoint.
- f (int): The sixth parameter representing the number of retries.
- g (list): The seventh parameter representing a list of options.
- h (dict): The eighth parameter representing additional configuration.

Returns:
None
"""
Sauron
  • 551
  • 2
  • 11
0

You can use a link to the API's documentation.

def func(a, b, c, d, e, f, g, h):
"""
Calls API and then does X.

Parameters are the same as for api().
See https://put/URL/here
"""
Barmar
  • 741,623
  • 53
  • 500
  • 612