我似乎无法弄清楚如何使用Sphinx记录异常。

我尝试了以下方法:

def some_funct():
    """
    :raises: ExceptionType: Some multi-line
        exception description.
    """


def some_funct():
    """
    :raises: ExceptionType, Some multi-line
        exception description.
    """


def some_funct():
    """
    :raises ExceptionType: Some multi-line
        exception description.
    """


def some_funct():
    """
    :raises:
        ExceptionType: Some multi-line
            exception description.
    """

狮身人面像一直在说:



那么,如何消除该消息?用多行文档记录可能的多个异常的正确方法是什么?

最佳答案

您可以将反斜杠用于行继续:

def some_funct():
    """
    :raises ExceptionType: Some multi-line \
        exception description.
    """

更新:

缩进似乎可以代替换行符:
def some_funct():
    """
    :raises ExceptionType: Some multi-line
        exception description.
    """

关于python - 如何使用Sphinx记录异常?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/15972544/

10-16 03:11