Name

The assert Statement

Synopsis

assert expression [, message]

Debugging checks. If expression is false, raises AssertionError, passing message as an extra data item if specified. The -O command-line flag removes assertion logic.

Get Python Pocket Reference, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.