How to document a module constant in Python?

后端 未结 8 1188
忘掉有多难
忘掉有多难 2020-12-13 11:57

I have a module, errors.py in which several global constants are defined (note: I understand that Python doesn\'t have constants, but I\'ve defined them by conv

8条回答
  •  北荒
    北荒 (楼主)
    2020-12-13 12:46

    the following worked for me with Sphinx 2.4.4:

    in foo.py :

    API_ERROR = 1
    """int: Indicates some unknown error."""
    
    

    then to document it:

    .. automodule:: foo.py 
        :members:
    
    

提交回复
热议问题