Pybites Logo

Suppressing exceptions

Level: Intermediate (score: 3)

Ever wanted to suppress an exception? Check out Python's contextlib module.

In this Bite you refactor sum_numbers which has some nested try/except statements. Use suppress to make this logic cleaner/ more readable. Have fun and keep calm and code in Python!