Skip to content

Use role :const: for referencing module constants #106909

@serhiy-storchaka

Description

@serhiy-storchaka

While technically Python modules are mutable and every name can be overridden, some names are not intended to be changed. Sphinx has a special directive for this: :const:. I think that it is better to use semantically more specific :const: instead of general :data: in these cases.

First of all it is all-uppercase names, but there are exceptions: curses.LINES and curses.COLS are changed after terminal changes size. But some lowercase names like os.sep and string.ascii_letters are also clearly constants.

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    docsDocumentation in the Doc dir

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions