diff --git a/pep-0654.rst b/pep-0654.rst index 656e92e0b95..a7a547d817a 100644 --- a/pep-0654.rst +++ b/pep-0654.rst @@ -218,9 +218,13 @@ contains only those exceptions for which the condition is true: >>> +The match condition is also applied to interior nodes (the exception +groups), and a match causes the whole subtree rooted at this node +to be included in the result. + Empty nested groups are omitted from the result, as in the case of ``ExceptionGroup("three")`` in the example above. If none of the -leaf exceptions match the condition, ``subgroup`` returns ``None`` rather +exceptions match the condition, ``subgroup`` returns ``None`` rather than an empty group. The original ``eg`` is unchanged by ``subgroup``, but the value returned is not necessarily a full new copy. Leaf exceptions are not copied, nor are exception groups which are