Python 3 文档字符串中返回值的多行描述

问题描述 投票:0回答:1

我的问题与这个SO问题非常相似:来自8年前 - 但是我更感兴趣的是使文档字符串的返回:部分多行。要点将是完美的,但强制换行是足够公平的,我可以管理它。

这是不可能的还是我只是一个假人?尝试了 reST 文档中的所有内容,搜索了 Google 并阅读了几天的论坛/主题。


这就是我将鼠标悬停在函数名称上时希望看到的内容。我正在使用最新版本的 PyCharm CE 和 Python 3.10 - 不确定它是否与这里相关。

def checkLimits4DataType(_min, _max, _dt):
"""
    Checks if min/max/datatype are specified in SS and PS. If they are,
    it checks if min/max are included in data type specific ranges. If they
    are not included, their value is replaced with data type specific ranges.
    :param _min: minimum value of signal/parameter (SS/PS)
    :param _max: maximum value of signal/parameter (SS/PS)
    :param _dt: data type of signal/parameter (SS/PS)
    :return: 1 - if dt = boolean
             0 - if limits are correct
             'dt specific ranges' - if min/max are out of their range
"""

这就是我实际看到的:

注意 Params: 部分实际上如何知道多行并且看起来漂亮整洁。我希望发生同样的行为,但无法使其发挥作用:(

python python-3.x restructuredtext docstring
1个回答
0
投票

你尝试过类似的事情吗:

def checkLimits4DataType(_min, _max, _dt):
"""
Checks if min/max/datatype are specified in SS and PS. If they are,
it checks if min/max are included in data type specific ranges. If they
are not included, their value is replaced with data type specific ranges.
:param _min: minimum value of signal/parameter (SS/PS)
:param _max: maximum value of signal/parameter (SS/PS)
:param _dt: data type of signal/parameter (SS/PS)
:return: :1 - if dt = boolean
         :0 - if limits are correct
         'dt specific ranges' - if min/max are out of their range

“”“

© www.soinside.com 2019 - 2024. All rights reserved.