class Choices(object): def __init__(self, *args): self._choices = [] for i, arg in enumerate(args): setattr(self, arg[0], i) self._choices.append((i, arg[1])) def __iter__(self): return iter(self._choices)