Google Style Python Docstrings: Dictionary of Multiple Types

140 Views Asked by At

I'm working on creating a Google Style Python Docstring for a dictionary that is of multiple types.

Dictionaries of a single type are specified as the following:

"""Takes in a dictionary.

Args:
    input (dict of str: int): The input to this fake function.
"""

What if my dictionary is all string keys, but multiple type values. What is the appropriate docstring for a Dictionary of multiple values?

i.e. observation_dictionary = {'velocity': 10.25, 'has_collided': False, 'weather_parameter': 'rain'}

"""Takes in a dictionary
Args:
    input (dict of str: [float, bool, str]): Is this valid?
"""

Bonus: What is the appropriate docstring for a dictionary of multiple key and value types?

i.e. observation_dictionary = {1: 'foo', 'bar': 2}

"""Takes in a dictionary
Args:
    input (dict of [str, int]: [str, int]): How about this?
"""

Thanks!

0

There are 0 best solutions below