微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Google Style Python Docstrings:多类型字典

如何解决Google Style Python Docstrings:多类型字典

我正在为多种类型的字典创建 Google Style Python Docstring。

单一类型的字典指定如下:

"""Takes in a dictionary.

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

如果我的字典都是字符串键,但有多个类型值怎么办。多值字典的合适文档字符串是什么?

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?
"""

额外奖励:对于具有多个键和值类型的字典,合适的文档字符串是什么?

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

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

谢谢!

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。