QuestionQ41

VerifiedAdvanced Object-Oriented Programming

Examine the following code snippet and choose the statement that most accurately describes it.

Question Image

Explanation

A value raised with raise must be an exception class or instance derived from BaseException. Because OwnMath is an ordinary class rather than an exception subclass, raise OwnMath from e raises a TypeError instead of validly raising a chained custom exception. Python Built-in Exceptions documentation

Learn more

Community Discussion

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