How to define an attribute in a Python 3 enum class that is NOT an enum value?
class Color(Enum):
red = 0
blue = 1
violet = 2
foo = 'this is a regular attribute'
bar = 55 # this is also a regular attribute
But this seems to fail for me. It seems that Color tries to include foo and bar as part of its enum values.
EDIT: Lest you think I'm not using Enum in a way that's intended... For example, take the official Python documentation's example enum class Planet (docs.python.org/3/library/enum.html#planet). Note that they define the gravitational constant G within the surface_gravity() method. But this is weird code. A normal programmer would say, set that constant G once, outside the function. But if I try to move G out (but not to global scope, just class scope), then I run into the issue I'm asking about here.