]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-110679: Improved markup in enum.rst (GH-110747)
authorKhalil Mouawad <99619908+khlmood@users.noreply.github.com>
Wed, 25 Oct 2023 17:32:09 +0000 (20:32 +0300)
committerGitHub <noreply@github.com>
Wed, 25 Oct 2023 17:32:09 +0000 (10:32 -0700)
Doc/library/enum.rst

index d9e08fc89652c7a6d42fd8e5ed209624bc3b2944..2d5ae361c3f1e3a0225919a4fcf63159c5e87395 100644 (file)
@@ -165,7 +165,7 @@ Data Types
    to subclass *EnumType* -- see :ref:`Subclassing EnumType <enumtype-examples>`
    for details.
 
-   *EnumType* is responsible for setting the correct :meth:`!__repr__`,
+   ``EnumType`` is responsible for setting the correct :meth:`!__repr__`,
    :meth:`!__str__`, :meth:`!__format__`, and :meth:`!__reduce__` methods on the
    final *enum*, as well as creating the enum members, properly handling
    duplicates, providing iteration over the enum class, etc.
@@ -406,7 +406,7 @@ Data Types
 
 .. class:: IntEnum
 
-   *IntEnum* is the same as *Enum*, but its members are also integers and can be
+   *IntEnum* is the same as :class:`Enum`, but its members are also integers and can be
    used anywhere that an integer can be used.  If any integer operation is performed
    with an *IntEnum* member, the resulting value loses its enumeration status.
 
@@ -437,7 +437,7 @@ Data Types
 
 .. class:: StrEnum
 
-   *StrEnum* is the same as *Enum*, but its members are also strings and can be used
+   ``StrEnum`` is the same as :class:`Enum`, but its members are also strings and can be used
    in most of the same places that a string can be used.  The result of any string
    operation performed on or with a *StrEnum* member is not part of the enumeration.
 
@@ -576,7 +576,7 @@ Data Types
 
 .. class:: IntFlag
 
-   *IntFlag* is the same as *Flag*, but its members are also integers and can be
+   ``IntFlag`` is the same as :class:`Flag`, but its members are also integers and can be
    used anywhere that an integer can be used.
 
       >>> from enum import IntFlag, auto
@@ -596,12 +596,12 @@ Data Types
         >>> Color.RED + 2
         3
 
-   If a *Flag* operation is performed with an *IntFlag* member and:
+   If a :class:`Flag` operation is performed with an *IntFlag* member and:
 
    * the result is a valid *IntFlag*: an *IntFlag* is returned
-   * the result is not a valid *IntFlag*: the result depends on the *FlagBoundary* setting
+   * the result is not a valid *IntFlag*: the result depends on the :class:`FlagBoundary` setting
 
-   The *repr()* of unnamed zero-valued flags has changed.  It is now:
+   The :func:`repr()` of unnamed zero-valued flags has changed.  It is now:
 
       >>> Color(0)
       <Color: 0>
@@ -697,7 +697,7 @@ Data Types
 
 .. class:: FlagBoundary
 
-   *FlagBoundary* controls how out-of-range values are handled in *Flag* and its
+   ``FlagBoundary`` controls how out-of-range values are handled in :class:`Flag` and its
    subclasses.
 
    .. attribute:: STRICT
@@ -720,7 +720,7 @@ Data Types
 
    .. attribute:: CONFORM
 
-      Out-of-range values have invalid values removed, leaving a valid *Flag*
+      Out-of-range values have invalid values removed, leaving a valid :class:`Flag`
       value::
 
          >>> from enum import Flag, CONFORM, auto
@@ -734,7 +734,7 @@ Data Types
 
    .. attribute:: EJECT
 
-      Out-of-range values lose their *Flag* membership and revert to :class:`int`.
+      Out-of-range values lose their :class:`Flag` membership and revert to :class:`int`.
 
          >>> from enum import Flag, EJECT, auto
          >>> class EjectFlag(Flag, boundary=EJECT):
@@ -747,7 +747,7 @@ Data Types
 
    .. attribute:: KEEP
 
-      Out-of-range values are kept, and the *Flag* membership is kept.
+      Out-of-range values are kept, and the :class:`Flag` membership is kept.
       This is the default for :class:`IntFlag`::
 
          >>> from enum import Flag, KEEP, auto
@@ -809,10 +809,10 @@ Utilities and Decorators
 .. class:: auto
 
    *auto* can be used in place of a value.  If used, the *Enum* machinery will
-   call an *Enum*'s :meth:`~Enum._generate_next_value_` to get an appropriate value.
-   For *Enum* and *IntEnum* that appropriate value will be the last value plus
-   one; for *Flag* and *IntFlag* it will be the first power-of-two greater
-   than the highest value; for *StrEnum* it will be the lower-cased version of
+   call an :class:`Enum`'s :meth:`~Enum._generate_next_value_` to get an appropriate value.
+   For :class:`Enum` and :class:`IntEnum` that appropriate value will be the last value plus
+   one; for :class:`Flag` and :class:`IntFlag` it will be the first power-of-two greater
+   than the highest value; for :class:`StrEnum` it will be the lower-cased version of
    the member's name.  Care must be taken if mixing *auto()* with manually
    specified values.