new enum idiom

Alex Martelli aleaxit at yahoo.com
Thu Jan 11 04:52:34 EST 2001


"Rainer Deyke" <root at rainerdeyke.com> wrote in message
news:fC576.21284$ge4.9901878 at news2.rdc2.tx.home.com...
    [snip]
> > >  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:-).
>
> The problem with 'bar=32' is that it cannot be interleaved with unnumbered
> args:
>
> >>> enum('foo', bar=32, 'fee')
> SyntaxError: non-keyword arg after keyword arg

Quotes vs metaquotes confusion -- I did mean 'bar=32', complete
with quotes (which is why I mentioned .split), not without (as
a keyword-argument).


Alex






More information about the Python-list mailing list