pycharm的docstring文档字符串风格

设置位置:
Tools -> Python Integrated Tools -> Docstrings -> Docstring format

五种风格:

  1. Plain
  2. reStructuredText
  3. Numpy
  4. Google
  5. Epytext

风格示例


# Plain
def foo1(a, b):
    """

    """
    return a+b

# reStructuredText
def foo2(a, b):
    """
    :param a:
    :param b:
    :return:
    """
    return a+b

# Numpy
def foo3(a, b):
    """
    Parameters
    ----------
    a
    b

    Returns
    -------

    """
    return a+b

# Google
def foo4(a, b):
    """
    Args:
        a:
        b:

    Returns:

    """
    return a + b

# Epytext
def foo(a, b):
    """
    @param a:
    @param b:
    @return:
    """
    return a+b

猜你喜欢

转载自blog.csdn.net/mouday/article/details/80515308
今日推荐