On this page
  1. bool
  2. Import & Availability
  3. Overview & Signature
  4. Common Methods & Attributes
  5. Usage
  6. Gotchas
  7. REPL Inspect

bool

Prev: bin | Up: __builtins__ | Next: breakpoint
Rel: int, float, complex, str, bytes
Ref: docs.python.org — bool
Tags: #public #python3 #builtins


Import & Availability

# Built-in (available globally without import)
from builtins import bool

Overview & Signature

bool(object=False, /)

Returns True when the argument is true, False otherwise.

Common Methods & Attributes

Usage

assert bool(1) is True and bool("hi") is True
assert bool(0) is False and bool("") is False and bool([]) is False

Gotchas

REPL Inspect

help(bool)

Linked from

Related notes