Skip to Content
Scientific Computing with Python - Second Edition
book

Scientific Computing with Python - Second Edition

by Claus Führer, Claus Fuhrer, Jan Erik Solem, Olivier Verdier
July 2021
Intermediate to advanced
392 pages
9h 40m
English
Packt Publishing
Content preview from Scientific Computing with Python - Second Edition
Error and Exception Handling

In this chapter, we will cover errors and exceptions and how to find and fix them. Handling exceptions is an important part of writing reliable and usable code. We will introduce basic built-in exceptions and show how to use and treat exceptions. We'll introduce debugging and show you how to use the built-in Python debugger.

In this chapter, we cover the following topics:

  • What are exceptions?
  • Finding errors: debugging

12.1 What are exceptions?

The first error that programmers (even experienced ones) are confronted with is when the code has incorrect syntax, meaning that the code instructions are not correctly formatted.

Consider this example of a syntax error:

>>> for i in range(10) File “<stdin>”, line 1 for ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Scientific Computing with Python 3

Scientific Computing with Python 3

Claus Führer, Claus Fuhrer, Jan Erik Solem, Olivier Verdier
Mastering Numerical Computing with NumPy

Mastering Numerical Computing with NumPy

Umit Mert Cakmak, Tiago Antao, Mert Cuhadaroglu

Publisher Resources

ISBN: 9781838822323Supplemental Content