I am using Google-style python docstring format. There's one function, and the input parameter could be dict, list, or string. What is the format of multiple data type in docstring?
Like
Args:
input (str, list, dict): input of this function
As it is stated in the Sphinx 1.5 documentation describing this style of formatting, PEP 484 type annotations are supported.
PEP 484 specifies the Union type as appropriate for a situation where you have a limited set of accepted types for an argument. In your example it will be:
Args:
input (Union[str, list, dict]): input of this function
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With