enum.Enum(Python 3.4+)

fromcollectionsimportnamedtuplefromenumimportEnumclassSpecies(Enum):cat=1dog=2horse=3aardvark=4butterfly=5owl=6platypus=7dragon=8unicorn=9# The list goes on and on...# But we don't really care about age, so we can use an alias.kitten=1puppy=2Animal=namedtuple('Animal','name age type')perry=Animal(name="Perry",age=31,type=Species.cat)drogon=Animal(name="Drogon",age=4,type=Species.dragon)tom=Animal(name="Tom",age=75,type=Species.cat)charlie=Animal(name="Charlie",age=2,type=Species.kitten)# And now, some tests.>>>charlie.type==tom.typeTrue>>>charlie.type<Species.cat:1>