LernerPython

Python exceptions

When something goes wrong in a Python program, we get an exception. But exceptions aren’t bad! They allow us to find and handle errors in our programs. They also allow us to indicate when something has gone wrong by raising an exception. In this webinar, I review how exceptions work, how to trap and use them, how to raise them, and how to create your own custom exceptions that won’t be mistaken with the internal ones.

What you should know

Course Content

Course length

2 hours

Number of lessons

1

Training materials

1 Jupyter notebook

Coding exercises

LEARN MORE

This is a recording of a webinar (special lecture for members) in which I describe Python exceptions — handling them, using them, raising them, and even customizing them. If you’ve ever wondered how exceptions are different from errors, how you can use them in your programs, and why you would ever want to raise them, this class will help you.

  • How an exception isn’t necessarily an error
  • Using and trapping exception objects
  • Custom exception classes
  • When and how to use “raise”

This course, like all others on LernerPython.com, is taught by Reuven Lerner.