【问题标题】:PyCharm autocomplete, list of typesPyCharm 自动完成,类型列表
【发布时间】:2012-08-03 06:25:26
【问题描述】:

我如何通过 Docstring 告诉 PyCharm 返回类型是 SomeClass 实例的列表?

已试用:@rtype [SomeClass],但它仅充当list

【问题讨论】:

    标签: python autocomplete casting pycharm heredoc


    【解决方案1】:
    def do_something():
        """
        @rtype: list of SomeClass
        """
        pass
    

    运行良好,将返回值解释为列表并在访问 list 元素时自动完成 SomeClass 方法。

    【讨论】:

      猜你喜欢
      • 2019-03-17
      • 2012-09-13
      • 2018-08-27
      • 2014-03-14
      • 1970-01-01
      • 2016-09-11
      • 2017-10-01
      • 2017-03-27
      • 1970-01-01
      相关资源
      最近更新 更多