[Chandler-dev] a new kind of enumeration type

Andi Vajda vajda at osafoundation.org
Thu Aug 31 21:44:02 PDT 2006


On Wed, 30 Aug 2006, Grant Baillie wrote:

> Perhaps I should've been more explicit :o). Instead of
>
>   class TriageEnum(schema.Enumeration):
>       values = {"now": 0, "later": 1, "done": -1}
>
> I would rather just write:
>
>   class TriageEnum(schema.Enumeration):
>       values = "done", "now", "later"
>

I just checked in changes to the schema API that implement this via a 'names' 
attribute:

    class TriageEnum(schema.Enumeration):
        names = "done", "now", "later"

defines three constants TriageEnum.done, TriageEnum.now and TriageEnum.later 
that are assigned the values 0, 1, and 2 respectively.

Andi..


More information about the chandler-dev mailing list