Multiple conditional expression
Chris Rebert
clp2 at rebertia.com
Thu Feb 26 22:17:20 EST 2009
On Thu, Feb 26, 2009 at 7:11 PM, Anjanesh Lekshminarayanan
<mail at anjanesh.net> wrote:
> How do I achieve something like this using python ?
> spaces = (form.has_key('spaces') ? form.getvalue('spaces') == 1 ? True
> : False : False)
>
> spaces = True if form.getvalue('spaces') == 1 if
> form.has_key('spaces') else False else False
That seems to just be an overly complicated way of writing:
spaces = bool(form.has_key('spaces') and form.getvalue('spaces') == 1)
Cheers,
Chris
--
Follow the path of the Iguana...
http://rebertia.com
More information about the Python-list
mailing list