Raising exceptions when an exception is already present in Python 3

前端 未结 5 1681
感情败类
感情败类 2020-12-14 05:52

What happens to my first exception (A) when the second (B) is raised in the following code?

class A(Exception): pass
class B(Except         


        
5条回答
  •  太阳男子
    2020-12-14 06:44

    1. It got thrown out.
    2. Only one exception can be "active" at a time per thread.
    3. You can't, unless you encapsulate the earlier exception in the later exception somehow.

提交回复
热议问题