[Python-ideas] constant/enum type in stdlib (original) (raw)
Terry Reedy tjreedy at udel.edu
Thu Jan 31 20:04:52 CET 2013
- Previous message: [Python-ideas] constant/enum type in stdlib
- Next message: [Python-ideas] constant/enum type in stdlib
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 1/31/2013 3:17 AM, Greg Ewing wrote:
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. :-)
Yeah, I was thinking that if it were added to stdlib, the current metaclass discussion in the reference should be augmented by referring to it as a non-toy example of metaclasses at work.
-- Terry Jan Reedy
- Previous message: [Python-ideas] constant/enum type in stdlib
- Next message: [Python-ideas] constant/enum type in stdlib
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]