diff -r 5c7697f28ee4 Doc/library/enum.rst --- a/Doc/library/enum.rst Mon Sep 02 08:57:21 2013 -0700 +++ b/Doc/library/enum.rst Tue Sep 03 01:32:48 2013 +0300 @@ -151,7 +151,7 @@ Ensuring unique enumeration values -================================== +---------------------------------- By default, enumerations allow multiple names as aliases for the same value. When this behavior isn't desired, the following decorator can be used to @@ -176,7 +176,7 @@ Iteration -========= +--------- Iterating over the members of an enum does not provide the aliases:: @@ -381,10 +381,10 @@ >>> Animals = Enum('Animals', 'ant bee cat dog', module=__name__) Derived Enumerations -==================== +-------------------- IntEnum -------- +^^^^^^^ A variation of :class:`Enum` is provided which is also a subclass of :class:`int`. Members of an :class:`IntEnum` can be compared to integers; @@ -439,7 +439,7 @@ Others ------- +^^^^^^ While :class:`IntEnum` is part of the :mod:`enum` module, it would be very simple to implement independently:: @@ -472,7 +472,7 @@ Interesting examples -==================== +-------------------- While :class:`Enum` and :class:`IntEnum` are expected to cover the majority of use-cases, they cannot cover them all. Here are recipes for some different @@ -481,7 +481,7 @@ AutoNumber ----------- +^^^^^^^^^^ Avoids having to specify the value for each enumeration member:: @@ -502,7 +502,7 @@ OrderedEnum ------------ +^^^^^^^^^^^ An ordered enumeration that is not based on :class:`IntEnum` and so maintains the normal :class:`Enum` invariants (such as not being comparable to other @@ -538,7 +538,7 @@ DuplicateFreeEnum ------------------ +^^^^^^^^^^^^^^^^^ Raises an error if a duplicate member name is found instead of creating an alias:: @@ -570,7 +570,7 @@ Planet ------- +^^^^^^ If :meth:`__new__` or :meth:`__init__` is defined the value of the enum member will be passed to those methods::