diff options
author | Ethan Furman <ethan@stoneleaf.us> | 2014-02-06 16:13:14 (GMT) |
---|---|---|
committer | Ethan Furman <ethan@stoneleaf.us> | 2014-02-06 16:13:14 (GMT) |
commit | c72e638643e0528f98ec28ad1617b466f9c0c575 (patch) | |
tree | c60b73e087e77371a9e8d8f0fde2fdbe66facfa8 /Doc/library/enum.rst | |
parent | 3303b6abc8ac9e28a614cb1fa47a57ace427e837 (diff) | |
download | cpython-c72e638643e0528f98ec28ad1617b466f9c0c575.zip cpython-c72e638643e0528f98ec28ad1617b466f9c0c575.tar.gz cpython-c72e638643e0528f98ec28ad1617b466f9c0c575.tar.bz2 |
Close issue20412: Updated Enum docs to have referencable Enum and IntEnum classes
Diffstat (limited to 'Doc/library/enum.rst')
-rw-r--r-- | Doc/library/enum.rst | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/Doc/library/enum.rst b/Doc/library/enum.rst index 2d20610..13f8a3c 100644 --- a/Doc/library/enum.rst +++ b/Doc/library/enum.rst @@ -15,14 +15,31 @@ ---------------- -An enumeration is a set of symbolic names (members) bound to unique, constant -values. Within an enumeration, the members can be compared by identity, and -the enumeration itself can be iterated over. +An enumeration is a set of symbolic names (members) bound to unique, +constant values. Within an enumeration, the members can be compared +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 sets of names and values: :class:`Enum` and :class:`IntEnum`. It also defines -one decorator, :func:`unique`, that ensures only unique member values are -present in an enumeration. +one decorator, :func:`unique`. + +.. 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 |