bare except

An except clause with no exception type, which catches every error, including typing mistakes and Control-C.

Swallowing every exception hides real bugs and can leave a program running in a broken state.

In more detail

It hides bugs: a NameError from a misspelt variable is silently swallowed. Catch the specific exceptions you expect, or at most except Exception, and never leave the handler empty without a reason.

Related terms

Taught in

References

Certification courses