new enum idiom

Steve Holden sholden at holdenweb.com
Wed Jan 10 21:20:20 EST 2001


"Rainer Deyke" <root at rainerdeyke.com> wrote in message
news:fC576.21284$ge4.9901878 at news2.rdc2.tx.home.com...
> "Alex Martelli" <aleaxit at yahoo.com> wrote in message
> news:93i57b01qms at news2.newsguy.com...
[ etc ]
> > 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
>
> Even if it could, there would be no way to determine the order of the
> arguments and therefore no way to find out that 'fee' should have a value
of
> 33.
>
This seems a little obtuse. What would be wrong with

    enum('foo', 'bar=32', 'fee')

regards
 Steve





More information about the Python-list mailing list