Grant Edwards <grant.b.edwa...@gmail.com>: > On 2016-04-13, Michael Selik <michael.se...@gmail.com> wrote: >> An Enum corresponds to "nominal" data that is coded as a number >> simply for storage rather than meaning. > > FWIW, as an old Pascal programmer, I too would have been surprised > that an "enum" is not ordinal and doesn't support a next/prev and > iteration. > > As an old C programmer, not so much. :)
>From the Pascal point of view, the "number for storage" seems odd. Why not: class Color(enum.Enum): red = "red" blue = "blue" green = "green" or: class Color(enum.Enum): red = object() blue = object() green = object() or: class Color(enum.Enum): red blue green This last one is to the point but raises a NameError. Personally, I have not found enum.Enum all that appealing. If I have needed such enums in my code, I have usually just defined: class MyClass: RED = "RED" BLUE = "BLUE" GREEN = "GREEN" Marko -- https://mail.python.org/mailman/listinfo/python-list