If not we should use the age-old hackish way of "making room for the future":

values = {"now": 1100, "later": 1200, "done": 1000, "soon": 1150}

Reid

On Aug 30, 2006, at 18:32, Grant Baillie wrote:
On 30 Aug, 2006, at 15:09, Phillip J. Eby wrote:
We could do that, after we got rid of any existing code that depends on the old semantics of enumerations.

However, it should be noted that this may lead to interesting problems in schema upgrades. My understanding is that the reason for wanting explicit values (as opposed to simple sequence) is that it allows constant values to be preserved across releases, even if things are added or removed. Second, it allows the use of enumerations as constants for interacting with external systems, like socket mode flags and such.

I guess I can get the behaviour I want with the lovely:

values = dict(map(reversed, enumerate(("done", "now", "later"))))


The backward compatibility point is a good one. BTW, if in α5 we decide we need a "soon" between "now" and "later", would

        values = {"now": 0, "later": 1, "done": -1, "soon": 0.5}

work?

--Grant


At 03:04 PM 8/30/2006 -0700, 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"

to produce the same values TriageEnum.done, TriageEnum.now, etc. (The
values would be auto-generated, but would sort the same as the dict
example).

--Grant

_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

Open Source Applications Foundation "chandler-dev" mailing list
http://lists.osafoundation.org/mailman/listinfo/chandler-dev

Reply via email to