On 6/29/05, Scott David Daniels <[EMAIL PROTECTED]> wrote: > result = [(lambda: expr0), lambda: expr1][cond]()
Which still has an error, as evidenced by the following: >>> cond = "" >>> result = [(lambda: expr0), lambda: expr1][cond]() Traceback (most recent call last): File "<stdin>", line 1, in ? TypeError: list indices must be integers Corrected version: result = [(lambda: expr0), lambda: expr1][bool(cond)]() Or if using python < 2.3: result = [(lambda: expr0), lambda: expr1][__import__("operator").truth(cond)]() Andrew -- http://mail.python.org/mailman/listinfo/python-list