Since there was talk of if-then-else not being allowed in lambda
expressions, the following is from "Dive into Python"

The and-or conditional expression trick from page 41 of "Dive into
Python"

Wrap the arguments in lists and then take the first element.

>>> a = ""
>>> b = "second"
>>> (1 and [a] or [b])[0]
''

--
Regards,
Casey
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to