O'Reilly logo

Python Programming On Win32 by Mark Hammond, Andy Robinson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Boolean Operations

The following table depicts the boolean operations, ordered by ascending priority.

Operation

Result

Notes

x or y

If x is false, then y, else x

1

x and y

If x is false, then x, else y

1

not x

If x is false, then 1, else 0

2

Notes

  1. These evaluate their second argument only if needed for their outcome.

  2. “Not” has a lower priority than non-boolean operators, e.g., not a == b is interpreted as not(a == b), and a == not b is a syntax error.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required