Pankaj ParasharDesigner. Developer. Writer.
Sep 06, 2015

The Diaper Pattern

Mike Pirnat wrote about the diaper pattern almost 6 years ago, but the essence of his writing is still fresh in my mind. It refers to the practice of catching generic exceptions in your code, allowing them to silently pass through your code which could yield dangerous results.

Its called diaper because it catches all the shit. In practice, it is always recommended to catch specific exceptions and let the code break for any runtime exceptions. This principle is not new and has been captured in the Zen of Python - PEP20.