
Jan. 31, 2013
2:17 a.m.
Cameron Simpson wrote:
How about this:
Color = enum(RED=None, WHITE=None, BLUE=None, yellow=9)
You see, this is the problem -- there are quite a number of these solutions, all about as good as each other, with none of them standing out as obviously the right choice for stdlib inclusion. Michael Foord's solution has promise, though, as it manages to eliminate *all* of the extraneous cruft and look almost like it's built into the language. Plus it has the bonus of making you go "...??? How the blazes does *that* work?" the first time you see it. :-) -- Greg