Skip to content
masterclassBuddyTech Buzz5 fresh blogs · 5:00 AM IST

Python · Class

bool

bool() converts an object through Python’s standard truth-testing procedure and returns True or False. With no argument it returns False; bool is an int subclass with only the two instances True and False.

Since
3.7

How it works

Calling bool() applies Python's standard truth-testing rules and produces one of the two Boolean objects. With no argument it produces False; the type is also an int subclass, cannot be extended by subclassing, and has only True and False as instances.

Syntax

class bool(object=False, /)

Parameters

NameTypeDescription
objectobject=False, positional-onlyObject to convert using standard truth testing; omitting it is equivalent to a false value.

Returns

A bool value: True when the argument is truthy, otherwise False.

Key points

  • The call always returns one of the two Boolean values: True or False.
  • An argument is evaluated according to Python's standard truth-testing rules before the result is produced.
  • False-like input and no argument yield False; every other truthy input yields True.
  • Boolean objects inherit from int, which explains their compatibility with integer-oriented operations.
  • Applications cannot create a custom subclass of bool.
  • There are exactly two bool objects available as Boolean instances.

Example: Convert values to booleans

value = "ready"
if bool(value):
    print("truthy")

print(bool([]))
print(bool(0))

The non-empty string is true, while an empty list and zero are false.

When to use it

Conditional checks

Validate whether an optional value, collection, or configuration field is present before branching.

Boolean normalization

Normalize inputs into an explicit Boolean for a flag, predicate result, or serialized state.

Custom truth protocols

Apply Python's truth-testing behavior to custom objects that define __bool__() or __len__().

Interview questions

QWhat does bool() do?

bool() returns either True or False after applying standard truth testing to its argument. Omitting the argument returns False.

Follow-up: What controls truth testing for a user-defined object? Its class can define __bool__(); if that is absent, Python can use __len__() to determine truth.

QHow is bool related to int?

bool is a subclass of int, so Boolean values can behave like 0 and 1 in numeric contexts. Despite that relationship, the documented Boolean instances are only False and True.

Follow-up: How should code make numeric intent explicit? Convert with int() rather than relying on Boolean-to-integer behavior.

QCan bool be subclassed, and how many instances does it have?

The built-in bool type cannot be subclassed further. It has exactly two constant instances: True and False.

Follow-up: What values are false in Boolean contexts? False, None, numeric zero, and empty strings or containers are interpreted as false.

  • True
  • False
  • int
  • and
  • or
  • not
  • __bool__
  • __len__

Source: Built-in Functions — Python 3.12.14 documentation. Checked 2026-10-16.