Created
April 27, 2012 16:10
-
-
Save razrichter/2510475 to your computer and use it in GitHub Desktop.
Simple python enum
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# as copied from http://stackoverflow.com/a/1695250 | |
def enum(*sequential, **named): | |
enums = dict(zip(sequential, range(len(sequential))), **named) | |
return type('Enum', (), enums) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment