Op 2005-06-29, Scott David Daniels schreef <[EMAIL PROTECTED]>:
> Roy Smith wrote:
>> Andrew Durdin <[EMAIL PROTECTED]> wrote:
>>>Corrected version:
>>>    result = [(lambda: expr0), lambda: expr1][bool(cond)]()
> Sorry, I thought cond was a standard boolean.
> Better is:
>      result = [(lambda: true_expr), lambda: false_expr][not cond]()

How about the following:

  result = (cond and (lambda: true_expr) or (lambda: false_expr))()

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

Reply via email to