mirror of
https://github.com/python/cpython.git
synced 2025-07-24 03:35:53 +00:00
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:
parent
7b3bc95067
commit
cd13f73afd
1 changed files with 7 additions and 6 deletions
|
@ -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::
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue