ID EN
Enum

KEEP

Python 3.11

Out-of-range values are kept, and the Flag membership is kept. This is the default for IntFlag:

Syntax

PYTHON
KEEP

Examples

Example 1
PYTHON
>>> from enum import Flag, KEEP, auto
>>> class KeepFlag(Flag, boundary=KEEP):
...     RED = auto()
...     GREEN = auto()
...     BLUE = auto()
>>> KeepFlag(2**2 + 2**4)
<KeepFlag.BLUE|16: 20>

See Also

IntFlag