1. Computing

Python Built-In Modules: Boolean Operations

By

These are the Boolean operations, ordered by ascending priority:

  • x or y: if x is false, then y, else x. The second argument is only evaluated if needed.
  • x and y: if x is false, then x, else y. The second argument is only evaluated if needed.
  • not x: if x is false, then True, else False. not has a lower priority than non-Boolean operators, so "not a == b" is interpreted as "not (a == b)". "a == not b" is regarded as a syntax error.

©2014 About.com. All rights reserved.