enumEasy Examples

Support for enumerations — named symbolic constants

Getting started with enum

Basic import and usage of the enum module.

python
from enum import Enum, auto

class Color(Enum):
    RED = auto()
    GREEN = auto()
    BLUE = auto()

print(Color.RED)
print(Color.RED.name)
print(Color.RED.value)
print(list(Color))

The enum module is part of Python's standard library. Support for enumerations — named symbolic constants.

Common enum operations

Frequently used functions from the enum module.

python
# More enum examples
import enum

print(f"enum module loaded successfully")
print(f"Location: {enum.__name__}")
print(f"Has {len(dir(enum))} attributes")

These are the most commonly used features of the enum module.

Want to try these examples interactively?

Open Easy Playground