Terry Reedy wrote:

> >   lambda x: {True:2,False:3}.get(bool(a))
>
> This is limited by the requirement that both branches be computable
> regardless of the value of the condition.
>
> > which is both beautiful and pythonic.
>
> Beauty is in the eye of the beholder.  It seems that relative pythonicity
> sometimes is also ;-).

That's what is really regrettable! Otherwise a creation of a "lazy
dict" that creates the value part of an item on demand would have been
reasonable to solve both the computational issue you mentioned and the
performance issue George worried about ( you are both right except for
the little example above :)

Kay

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to