missing 'xor' Boolean operator
Mark Dickinson
dickinsm at gmail.com
Sat Jul 18 05:50:06 EDT 2009
On Jul 17, 12:06 pm, Jean-Michel Pichavant <jeanmic... at sequans.com>
wrote:
> I was saying that using boolean operators with object instead of boolean
> values is error prone,
I agree with this to some extent. After all, Python conditional
expressions were eventually introduced in response to buggy uses of
the 'a and b or c' idiom. See PEP 308, and:
http://mail.python.org/pipermail/python-dev/2005-September/056546.html
In my own code, I'm finding myself increasingly using conditional
expressions where I would once have used 'and' or 'or':
daysInAdvance = int(inputVar) if inputVar is not None else 0
--
Mark
More information about the Python-list
mailing list