As described in PEP435, an enum can be defined this way:
class Color(Enum):
red = 1
green = 2
blue = 3
And the resulting enum members of Color can be iterated in definition order: Color.red, Color.green, Color.blue.
This reminds me of Form in Django, in which fields can be rendered in the order they are declared in a Form subclass. They implemented this by maintaining a field counter, every time a new field is instantiated the counter value get incremented.
But in the definition of Color, we don't have something like a FormField, how can we implement this?