Chapter 17

Handling Errors in Python

IN THIS CHAPTER

Check Understanding Python bugs

Check Considering bug sources

Check Locating and describing Python errors

Check Squashing Python bugs

Chapter 16 discusses errors in code from a Haskell perspective, and some of the errors you encounter in Haskell might take you by surprise. Oddly enough, so might some of the coding techniques used in other languages that would appear as errors. (Chapter 16 also provides a good reason not to compare the bug mitigation properties of various languages in the “Reducing the number of bugs” sidebar.) Python is more traditional in its approach to errors. For example, dividing a number by zero actually does produce an error, not a special data type designed to handle the division using the value Infinity. Consequently, you may find the discussion (in the first section of this chapter) of what constitutes a bug in Python a little boring if you have worked through coding errors in other procedural languages. Even so, reading the material is a good idea so that you can better understand how Python and Haskell differ in their handling ...

Get Functional Programming For Dummies 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.