mirror of
https://github.com/python/cpython.git
synced 2025-11-11 22:55:08 +00:00
Close issue20412: Updated Enum docs to have referencable Enum and IntEnum classes
This commit is contained in:
parent
3303b6abc8
commit
c72e638643
1 changed files with 22 additions and 5 deletions
|
|
@ -15,14 +15,31 @@
|
||||||
|
|
||||||
----------------
|
----------------
|
||||||
|
|
||||||
An enumeration is a set of symbolic names (members) bound to unique, constant
|
An enumeration is a set of symbolic names (members) bound to unique,
|
||||||
values. Within an enumeration, the members can be compared by identity, and
|
constant values. Within an enumeration, the members can be compared
|
||||||
the enumeration itself can be iterated over.
|
by identity, and the enumeration itself can be iterated over.
|
||||||
|
|
||||||
|
|
||||||
|
Module Contents
|
||||||
|
---------------
|
||||||
|
|
||||||
This module defines two enumeration classes that can be used to define unique
|
This module defines two enumeration classes that can be used to define unique
|
||||||
sets of names and values: :class:`Enum` and :class:`IntEnum`. It also defines
|
sets of names and values: :class:`Enum` and :class:`IntEnum`. It also defines
|
||||||
one decorator, :func:`unique`, that ensures only unique member values are
|
one decorator, :func:`unique`.
|
||||||
present in an enumeration.
|
|
||||||
|
.. class:: Enum
|
||||||
|
|
||||||
|
Base class for creating enumerated constants. See section
|
||||||
|
:ref:`Functional API` for an alternate construction syntax.
|
||||||
|
|
||||||
|
.. class:: IntEnum
|
||||||
|
|
||||||
|
Base class for creating enumerated constants that are also
|
||||||
|
subclasses of :class:`int`.
|
||||||
|
|
||||||
|
.. function:: unique
|
||||||
|
|
||||||
|
Enum class decorator that ensures only one name is bound to any one value.
|
||||||
|
|
||||||
|
|
||||||
Creating an Enum
|
Creating an Enum
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue