Question
Asked By – Joan Venge
Possible Duplicate:
How can I represent an ‘enum’ in Python?
What’s the common practice for enums in Python? I.e. how are they replicated in Python?
public enum Materials
{
Shaded,
Shiny,
Transparent,
Matte
}
Now we will see solution for issue: What’s the common practice for enums in Python? [duplicate]
Answer
class Materials:
Shaded, Shiny, Transparent, Matte = range(4)
>>> print Materials.Matte
3
This question is answered By – Van Gale
This answer is collected from stackoverflow and reviewed by FixPython community admins, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0