Skip to content

Instantly share code, notes, and snippets.

@miceno
Last active August 29, 2015 14:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save miceno/2b8d750c8fefe7c0b932 to your computer and use it in GitHub Desktop.
Save miceno/2b8d750c8fefe7c0b932 to your computer and use it in GitHub Desktop.
Enumeration in python
>>> Status = namedtuple('Status', 'open pending closed')._make(range(3))
>>> Status.open, Status.pending, Status.closed
(0, 1, 2)
>>> class Status:
open, pending, closed = range(3)
>>> Status.open, Status.pending, Status.closed
(0, 1, 2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment