A special kind of Enum that inherits from the base Enum class and int.

Why use this?

You can perform integer operations on it.

from enum import IntEnum
 
class MyIntEnum(IntEnum):
    First = 1
    Second = 2
 
assert MyIntEnum.First == 1
assert MyIntEnum.First + MyIntEnum.Second == 3

Interestingly, since this class represents both an enum and an int, you can use it to convert a regular int into your enum class:

>>> MyIntEnum(2)
<MyIntEnum.Second: 2>