1. Home
  2. Computing & Technology
  3. Python

Python Built-In Modules: Boolean Operations

From , former About.com Guide

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.
Explore Python
About.com Special Features

The Best Web Trends of the Decade

A look back at the best innovations, ideas and technologies over the last 10 years, More >

Family Tech Center

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

  1. Home
  2. Computing & Technology
  3. Python
  4. Python Library
  5. Python Modules - Boolean Operations - Boolean Operators>

©2009 About.com, a part of The New York Times Company.

All rights reserved.