Multiple conditional expression

bearophileHUGS at lycos.com bearophileHUGS at lycos.com
Fri Feb 27 03:55:06 EST 2009


Chris Rebert:
> That seems to just be an overly complicated way of writing:
>
> spaces = bool(form.has_key('spaces') and form.getvalue('spaces') == 1)

Better:

spaces = bool(('spaces' in form) and form.getvalue('spaces') == 1)

Bye,
bearophile



More information about the Python-list mailing list