Consider:
class Item:
def __init__(self, a, b):
self.a = a
self.b = b
class Items:
GREEN = Item(\'a\', \'b\')
BLUE = Item(\'c\', \'
Here's another approach which I think is simpler than the others, but allows the most flexibility:
from collections import namedtuple
from enum import Enum
class Status(namedtuple('Status', 'name description'), Enum):
READY = 'ready', 'I am ready to do whatever is needed'
ERROR = 'error', 'Something went wrong here'
def __str__(self) -> str:
return self.name
Works as expected:
print(Status.READY)
print(repr(Status.READY))
print(Status.READY.description)
print(Status.READY.value)
prints:
ready
I am ready to do whatever is needed
Status(name='ready', description='I am ready to do whatever is needed')
You get the best of namedtuple and Enum.