mirror of
https://github.com/python/cpython.git
synced 2025-11-02 03:01:58 +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.
|
||||
|
||||
>>> 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::
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue