Change the future

Friday 10:50 a.m.–11:20 a.m.

How to Except When You're Excepting

Esther Nam

Audience level:
Novice
Category:
Best Practices/Patterns

Description

This talk is an introduction to the practice of exception handling, aimed at those without a heavy CS background or years of experience, and who are thus unfamiliar with the technique. Novices to Python will learn Python-specific techniques that make use of built-in exceptions and the context manager, as well as unusual but Pythonic ways of managing the flow control of their program.

Abstract

Exception handling is a form of defensive programming, requiring the programmer to anticipate possible points of failure in his/her code, and think through methods for handling such failures in a graceful way. In this talk, I will:

  • Describe various types of exceptions that can occur (system- and application- level).
  • Compare and contrast naive ways to handle exceptions versus well-known design patterns for exception handling, especially as related to debugging.
  • Cover various best practices for catching, recovering from, or otherwise handling exceptions, including ways to take advantage of Python-specific features, such as the context manager and built-in Exception types.
  • Explain the consequences of Exception handling, as relating to general principles of flow control.

The listener should walk away with a better idea of why proper exception handling is important, as well as when and how to do so. They should also leave wondering how to get better at sussing out where failure points might occur in their code, and how to deal with unexpected events in a graceful manner.