Return to Snippet

Revision: 68129
at December 1, 2014 05:01 by miceno


Initial Code
>>> 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)

Initial URL

                                

Initial Description
Simple ways to get enumerations in python.

Initial Title
Enumeration in python

Initial Tags

                                

Initial Language
Python