QuestionQ80

VerifiedCoding Conventions, Best Practices, and Standardization

Select the statements that are true about PEP 8 programming recommendations for exception handling.

Choose two
Explanation

PEP 8 advises naming specific exceptions whenever possible instead of using a bare except: clause, since bare except: also catches SystemExit and KeyboardInterrupt. It also recommends deriving exceptions from Exception rather than BaseException; direct BaseException inheritance is reserved for exceptions that generally should not be caught.

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!