32904/how-can-i-represent-an-enum-in-python
Here is one implementation:
class Enum(set): def __getattr__(self, name): if name in self: return name raise AttributeError
Here is its usage:
Animals = Enum(["DOG", "CAT", "HORSE"]) print(Animals.DOG)
down voteacceptedFor windows: you could use winsound.SND_ASYNC to play them ...READ MORE
You probably want to use np.ravel_multi_index: [code] import numpy ...READ MORE
is there a different platform for this ...READ MORE
It's pretty simple to raise a query raise ...READ MORE
You can also use the random library's ...READ MORE
Syntax : list. count(value) Code: colors = ['red', 'green', ...READ MORE
Enumerate() method adds a counter to an ...READ MORE
You can simply the built-in function in ...READ MORE
For Python 2.6 and later and Python ...READ MORE
The datetime class has a method strftime. strftime() ...READ MORE
OR
At least 1 upper-case and 1 lower-case letter
Minimum 8 characters and Maximum 50 characters
Already have an account? Sign in.