Summary

The key concepts in this chapter were exceptions and errors. We showed how an exception is raised to be later in another program unit caught. You can define your own exceptions and equip them with messages and current values of given variables.

Code may return unexpected results without throwing an exception. The technique to localize the source of the erroneous result is called debugging. We introduced debugging methods and hopefully encouraged you to train them so that you have them readily available when needed. The need for serious debugging comes sooner than you might expect.

Get Scientific Computing with Python 3 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.