PyDocs

Nav

Data Types

IntFlag

enum

class (source)
  • IntFlag(new_class_name, /, names, *, module=None, qualname=None, type=None, start=1, boundary=None)
Support for integer-based Flags
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. Inversion of an IntFlag now returns a positive value that is the union of all flags not in the given flag, rather than a negative value. This matches the existing Flag behavior.
1 Example
>>> from enum import IntFlag, auto
>>> class Color(IntFlag):
...     RED = auto()
...     GREEN = auto()
...     BLUE = auto()
...
>>> Color.RED & 2
<Color: 0>
>>> Color.RED | 2
<Color.RED|GREEN: 3>
from the Python docs
See Also
No see-alsos for enum/IntFlag
0 Notes
No notes for IntFlag