The boolean evaluations of different values in different languages:



Values evaluated to be false.

  1. Constants defined to be false: None and False.
  2. Zero of any numeric type: 0, 0.0, 0j, Decimal(0), Fraction(0, 1)
  3. Empty sequences and collections: '', (), [], {}, set(), range(0)



  1. Objects evaluate to true
  2. Undefined evaluates to false
  3. Null evaluates to false
  4. Booleans evaluate to the value of the boolean
  5. Numbers evaluate to false if +0, -0, or NaN, otherwise true
  6. Strings evaluate to false if an empty string '', otherwise true