On this page
enum.global_enum_repr
Prev: enum.global_enum | Up: enum | Next: enum.global_flag_repr
Rel: enum.auto, enum.Enum, enum.EnumCheck, enum.EnumDict
Ref: docs.python.org — enum.global_enum_repr
Tags: #public #python3 #stdlib #enum
Import
import enum
from enum import global_enum_repr
Signature & Overview
enum.global_enum_repr(self)
use module.enum_name instead of class.enum_name the module is the last module in case of a multi-module name
Usage
from enum import Enum, global_enum_repr
class Code(Enum):
OK = 0
assert "OK" in global_enum_repr(Code.OK)
Gotchas
- Formatting helper (Python 3.11+): Formats an enum member as
module.MEMBERrather thanClass.MEMBER; typically applied automatically by@global_enum.
REPL Inspect
from enum import global_enum_repr
help(global_enum_repr)
Linked from
Related notes
- tuts/python3/stdlib_module/enum/global_enum Linked here; links to this page; shared tags: #enum, #stdlib
- tuts/python3/stdlib_module/enum/global_flag_repr 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