[3.11] gh-104659: Consolidate python examples in enum documentation (#104665) (#104666)

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

(cherry picked from commit 3ac856e697)

Co-authored-by: Thomas Hisch <t.hisch@gmail.com>
This commit is contained in:
Hugo van Kemenade 2023-05-19 23:12:57 +03:00 committed by GitHub
parent 7b3bc95067
commit cd13f73afd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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::