10.8. Standard Exceptions

Table 10.2 lists all of Python's current set of standard exceptions. All exceptions are loaded into the interpreter as a built-in so they are ready before your script starts or by the time you receive the interpreter prompt, if running interactively.

All standard/built-in exceptions are derived from the root class Exception. There are currently two immediate subclasses of Exception: SystemExit and StandardError. All other built-in exceptions are subclasses of StandardError. Every level of indentation of an exception listed in Table 10.2 indicates one level of exception class derivation.

Table 10.2. Python Standard Exceptions
Exception NameDescription
Exception[a]root class for all exceptions
SystemExitrequest termination ...

Get Core Python Programming 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.