Article / 文章中心

pycharm的docstring文档字符串风格

发布时间:2021-11-23 点击数:320
简介: 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