Skip to content
Advertisement

Linking python enums

I have some Enum classes that I want to link up recursively. Looking at the line color = ItemColors[Items(value)._name_].value.value, it seems a bit clunky. Am I misunderstanding something about Enum usage? Is there a better way to do it?

JavaScript

Advertisement

Answer

Building on @brni’s answer, I came up with a smoother solution:

JavaScript
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement