[Python-ideas] Break the dominance of boolean values in boolean context

Greg Ewing greg.ewing at canterbury.ac.nz
Fri Sep 16 01:57:26 CEST 2011

Chris Rebert wrote:

> So, you want this in order to avoid (e.g.) `X & Y` and `not_(Z)`, in
> favor of `X and Y` and `not Z`?

Yes. The problem with & and | is that their precedence is all
wrong in relation to the comparison operators. So instead of

    a == 17 and b == 42

you have to write

    (a == 17) & (b == 42)

And not_(x) is just plain ugly.


More information about the Python-ideas mailing list