BaseException

In Python, BaseException is a built-in exception that serves as the base class for all exceptions. It’s the root of the exception class hierarchy, meaning that all other exceptions are derived from this class.

Typically, you won’t raise or catch BaseException directly in your code. Instead, you’ll work with some of its specific subclasses like Exception, ValueError, TypeError, and others.

BaseException Practical Use Cases

  • Serves as the base class for all other exceptions
  • Not intended to be directly used in user code for raising or catching exceptions

Tutorial

Python's Built-in Exceptions: A Walkthrough With Examples

In this tutorial, you'll get to know some of the most commonly used built-in exceptions in Python. You'll learn when these exceptions can appear in your code and how to handle them. Finally, you'll learn how to raise some of these exceptions in your code.

intermediate python

For additional information on related topics, take a look at the following resources:


By Leodanis Pozo Ramos • Updated March 6, 2025 • Reviewed by Martin Breuss