How to document a module constant in Python?

后端 未结 8 1180
忘掉有多难
忘掉有多难 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:42

    I think you're out of luck here.

    Python don't support directly docstrings on variables: there is no attribute that can be attached to variables and retrieved interactively like the __doc__ attribute on modules, classes and functions.

    Source.

提交回复
热议问题