Passing Exceptions 101: Paradigms in Error Handling

0 0

Exception handling in Python can sometimes feel like a Wild West. If you have a , function, and the caller inputs an invalid email address, should it: A) Return , or some other special return value, B) Let the underlying exception it might cause bubble up, C) Check via a regex and type checking and raise a , immediately, or D) Make a custom , subclass and raise that?,What if there is a network error while the email was sending? Or what if the function calls a helper , that returns an integer (clearly wrong!

PyCon US 2017

The PyCon 2017 conference, which will take place in Portland, is the largest annual gathering for the community using and developing the open-source Python programming language. It is produced and ...