new enum idiom

Alex Martelli aleaxit at yahoo.com
Wed Jan 10 12:12:01 EST 2001


"Robert Amesz" <rcameszREMOVETHIS at dds.removethistoo.nl> wrote in message
news:90259DC4Arcamesz at 127.0.0.1...
    [snip]
> >That's one possibility.  Syntax such as "bar=32" (for names in the
> >enumlist whose value is explicitly defined) being another
    [snip]
> Either way seems rather ugly to me. Why not use tuples to visually
> suggest the link between the value and the string? In this case that
> would make:
>
>  xx = enum('foo', ('bar',32), 'fee', ('fie',45), 'flip', 'flop')
>
> It also would be much easier to parse the argument list in that form.

Fine, but can't be "*much* easier" -- it's just one .split away from
the 'bar=32' proposal to ('bar','32'), after all:-).


Alex






More information about the Python-list mailing list