Skip to content

doc(enum): add missing imports so standalone examples run as-is #139487

@ttw225

Description

@ttw225

Documentation

Several examples in Doc/library/enum.rst are meant to be runnable as standalone doctest-style blocks, but a few miss required imports (Enum, auto, StrEnum). Adding minimal from enum import ... lines makes each block self-contained.

The current documentation is correct; this change simply improves convenience for newcomers and first-time readers by making the snippets runnable in isolation.

Example (why this helps):

Before (fails):

>>> class Weekday(Enum):
...     MONDAY = 1
NameError: name 'Enum' is not defined

After (works):

>>> from enum import Enum
>>> class Weekday(Enum):
...     MONDAY = 1

Notes

  • The change aims to be minimal and localized to the affected blocks.
  • No NEWS entry should be required (docs-only).

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    docsDocumentation in the Doc dir

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions