Chapter 10. Errors And Exceptions

Chapter Topics

  • What Are Exceptions?

  • Exceptions in Python

  • Detecting and Handling Exceptions

    • try-except Statement

    • Exception Arguments

    • else Statement

    • try-finally Statement

  • Exceptions Are Classes

  • Raising Exceptions

    • raise Statement

  • Assertions

    • assert Statement

  • Standard Exceptions

  • Creating Exceptions

  • Why Exceptions (Now)?

  • Why Exceptions at All?

  • Related Modules

Errors are an everyday occurrence in the life of a programmer. In days hopefully long since past, errors were either fatal to the program (or perhaps the machine) or produced garbage output that was neither recognized as valid input by other computers or programs nor by the humans who submitted the job to be run. Any time an error occurred, execution was halted until the error ...

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.