Never Catch All Exceptions

You should be explicit about the name of the exceptions you will catch for more precise error handling. Catching any exceptions can cause unintended consequences.

For example, in the code above, the error message returned is “Cannot divide by zero,” even though the actual error is TypeError.

My previous tips on good Python practices.

Scroll to Top