Python 函数如何明确表示其某个前置条件未满足?
使用 raise Exception("helpful message")。
raise Exception("helpful message")
调用 logging.debug(),并假定它会自动引发异常。
logging.debug()
返回 Exception 类,但不引发异常。
Exception
打印错误消息,并始终继续执行函数。