PyDocs

Nav

Data Types

IntEnum

enum

class (source)
  • IntEnum(new_class_name, /, names, *, module=None, qualname=None, type=None, start=1, boundary=None)
Enum where members are also (and must be) ints
Changed in 3.11
  • 3.11: __str__() is now int.__str__() to better support the replacement of existing constants use-case. __format__() was already int.__format__() for that same reason.
1 Example
>>> from enum import IntEnum
>>> class Number(IntEnum):
...     ONE = 1
...     TWO = 2
...     THREE = 3
...
>>> Number.THREE
<Number.THREE: 3>
>>> Number.ONE + Number.TWO
3
>>> Number.THREE + 5
8
>>> Number.THREE == 3
True
from the Python docs
See Also
No see-alsos for enum/IntEnum
0 Notes
No notes for IntEnum