So the Enum
has a __members__
dict.
The solution that @ozgur proposed is really the best, but you can do this, which does the same thing, with more work
[color.value for color_name, color in Color.__members__.items()]
The __members__
dictionary could come in handy if you wanted to insert stuff dynamically in it... in some crazy situation.
[EDIT]
Apparently __members__
is not a dictionary, but a map proxy. Which means you can't easily add items to it.
You can however do weird stuff like MyEnum.__dict__['_member_map_']['new_key'] = 'new_value'
, and then you can use the new key like MyEnum.new_key
.... but this is just an implementation detail, and should not be played with. Black magic is payed for with huge maintenance costs.