Skip to content

Commit

Permalink
[3.11] gh-104659: Consolidate python examples in enum documentation (#…
Browse files Browse the repository at this point in the history
…104665) (#104666)

gh-104659: Consolidate python examples in enum documentation (#104665)

(cherry picked from commit 3ac856e)

Co-authored-by: Thomas Hisch <t.hisch@gmail.com>
  • Loading branch information
hugovk and twmr committed May 19, 2023
1 parent 7b3bc95 commit cd13f73
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions Doc/library/enum.rst
Original file line number Diff line number Diff line change
Expand Up @@ -404,17 +404,18 @@ Data Types
with an *IntEnum* member, the resulting value loses its enumeration status.

>>> from enum import IntEnum
>>> class Numbers(IntEnum):
>>> class Number(IntEnum):
... ONE = 1
... TWO = 2
... THREE = 3
>>> Numbers.THREE
<Numbers.THREE: 3>
>>> Numbers.ONE + Numbers.TWO
...
>>> Number.THREE
<Number.THREE: 3>
>>> Number.ONE + Number.TWO
3
>>> Numbers.THREE + 5
>>> Number.THREE + 5
8
>>> Numbers.THREE == 3
>>> Number.THREE == 3
True

.. note::
Expand Down

0 comments on commit cd13f73

Please sign in to comment.