Skip to content

Instantly share code, notes, and snippets.

@jyesselm
Last active May 26, 2016 02:06
Show Gist options
  • Save jyesselm/6b2239e725485c5c595af466bfc7c8cc to your computer and use it in GitHub Desktop.
Save jyesselm/6b2239e725485c5c595af466bfc7c8cc to your computer and use it in GitHub Desktop.
from enum import Enum # for enum34, or the stdlib version
Animal = Enum('Animal', 'ant bee cat dog')
class Animal2(Enum):
ant = 1
bee = 2
cat = 3
dog = 4
a = Animal.ant
print a # will print Animal.ant
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment