StaticModel provides tools for modeling and working with tabular constants.
>>> from staticmodel import StaticModel
>>>
>>>
>>> class AnimalType(StaticModel):
... _field_names = 'name', 'description', 'has_legs'
...
... DOG = 'Dog', "Man's best friend", True
... SNAKE = 'Snake', "Man's slithering companion", False
...
... def walk(self):
... if self.has_legs:
... return '{} walking...'.format(self.name)
... return "{} can't walk.".format(self.name)
...
>>> AnimalType.DOG.walk()
'Dog walking...'
>>> AnimalType.members.get(name='Snake')
<AnimalType.SNAKE: name='Snake', description="Man's slithering companion", has_legs=False>
Read the full documentation: https://staticmodel.readthedocs.org/en/latest.