On this page
enum.global_flag_repr
Prev: enum.global_enum_repr | Up: enum | Next: enum.global_str
Rel: enum.auto, enum.Enum, enum.EnumCheck, enum.EnumDict
Ref: docs.python.org — enum.global_flag_repr
Tags: #public #python3 #stdlib #enum
Import
import enum
from enum import global_flag_repr
Signature & Overview
enum.global_flag_repr(self)
use module.flag_name instead of class.flag_name the module is the last module in case of a multi-module name
Usage
from enum import Flag, global_flag_repr
class Bits(Flag):
A = 1
B = 2
assert "A" in global_flag_repr(Bits.A | Bits.B)
Gotchas
- Formatting helper for
Flagmembers (Python 3.11+): Formats combined flags asmodule.A|module.B; usually used via@global_enum.
REPL Inspect
from enum import global_flag_repr
help(global_flag_repr)
Linked from
Related notes
- tuts/python3/stdlib_module/enum/global_enum_repr Linked here; links to this page; shared tags: #enum, #stdlib
- tuts/python3/stdlib_module/enum/global_str Linked here; links to this page; shared tags: #enum, #stdlib
- tuts/python3/stdlib_module/enum/auto Linked here; shared tags: #enum, #stdlib
- tuts/python3/stdlib_module/enum/Enum Linked here; shared tags: #enum, #stdlib
- tuts/python3/stdlib_module/enum/EnumCheck Linked here; shared tags: #enum, #stdlib
- tuts/python3/stdlib_module/enum/EnumDict Linked here; shared tags: #enum, #stdlib
- tuts/python3/stdlib_module/enum links to this page; shared tags: #stdlib
- tuts/python3/stdlib_module/enum/EnumMeta shared tags: #enum, #stdlib
- tuts/python3/stdlib_module/enum/EnumType shared tags: #enum, #stdlib
- tuts/python3/stdlib_module/enum/Flag shared tags: #enum, #stdlib