mirror of
https://github.com/python/cpython.git
synced 2025-11-13 07:26:31 +00:00
gh-104659: Consolidate python examples in enum documentation (#104665)
This commit is contained in:
parent
27a7d5e1cd
commit
3ac856e697
1 changed files with 6 additions and 6 deletions
|
|
@ -406,18 +406,18 @@ Data Types
|
||||||
with an *IntEnum* member, the resulting value loses its enumeration status.
|
with an *IntEnum* member, the resulting value loses its enumeration status.
|
||||||
|
|
||||||
>>> from enum import IntEnum
|
>>> from enum import IntEnum
|
||||||
>>> class Numbers(IntEnum):
|
>>> class Number(IntEnum):
|
||||||
... ONE = 1
|
... ONE = 1
|
||||||
... TWO = 2
|
... TWO = 2
|
||||||
... THREE = 3
|
... THREE = 3
|
||||||
...
|
...
|
||||||
>>> Numbers.THREE
|
>>> Number.THREE
|
||||||
<Numbers.THREE: 3>
|
<Number.THREE: 3>
|
||||||
>>> Numbers.ONE + Numbers.TWO
|
>>> Number.ONE + Number.TWO
|
||||||
3
|
3
|
||||||
>>> Numbers.THREE + 5
|
>>> Number.THREE + 5
|
||||||
8
|
8
|
||||||
>>> Numbers.THREE == 3
|
>>> Number.THREE == 3
|
||||||
True
|
True
|
||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue