Hey Irit,
find my 3 answers below:
On 03.03.21 13:17, Irit Katriel wrote:
Hi Sven,
I like your formatting suggestion, thanks. I will do something like that.
You're welcome.
I'm not sure I understand your question. ExceptionGroup is a subclass
of Exception (which is a subclass of BaseException). So ExceptionGroup
is caught by "except Exception" or "except BaseException".
1) So I understand "try-except BaseException" (cf. concurrent.futures)
will work without fixes (i.e. produce the same results).
BaseExceptionGroup is a subclass only of BaseException so it is caught
by "except BaseException" but not "except Exception". And
ExceptionGroup is allowed to wrap only Exceptions while BaseException
can wrap Exceptions and and BaseExceptions. Makes sense?
2) Can you add motivating examples for "BaseExceptionGroup vs
ExceptionGroup" in the PEP? Right now, I only see what the consequences
are but not why it was done this way.
3) Can you explain (and show the reasoning behind) this automatic choice
in the PEP? Sounds a bit like hidden magic to me.
Referring to: "The difference between them is that ExceptionGroup can
only wrap Exception subclasses while BaseExceptionGroup can wrap any
BaseException subclass. A factory method that inspects the nested
exceptions and selects between ExceptionGroup and BaseExceptionGroup
makes the choice automatic."
Best
Sven
PS:
the reason why I was a bit puzzled by the
BaseExceptionGroup/ExceptionGroup issue is that:
- if it doesn't matter (so we do it automatically, because we do not
want to bother anybody), why do we need ExceptionGroup at all,
BaseExceptionGroup seems more flexible?
- if it does matter, why is the choice automatic and what if it was the
wrong choice?
_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at
https://mail.python.org/archives/list/python-dev@python.org/message/4TEOPEX7EELLZUUFAODZ6XU7HF7FUE54/
Code of Conduct: http://python.org/psf/codeofconduct/