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

This commit is contained in:
Thomas Hisch 2023-05-19 19:46:20 +02:00 committed by GitHub
parent 27a7d5e1cd
commit 3ac856e697
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -406,18 +406,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::