[Python-Dev] Re: PEP 654 -- Exception Groups and except* : request for feedback for SC submission

2021年2月26日 17:04:02 -0800

On Fri, Feb 26, 2021 at 11:43 PM Guido van Rossum <[email protected]> wrote:
> On Fri, Feb 26, 2021 at 3:18 PM Marco Sulla <[email protected]>
> wrote:
>
>> Excuse me if I post here. Maybe is a stupid question: why, instead of
>> introducing except*, Python can't extend the functionality of except,
>> so it can do what except* would do?
>>
>
> Good question. Here's an example:
> ```
> try:
> . . .
> except OSError as err:
> if err.errno != ENOENT:
> raise
> . . .
> ```
> If this would catch ExceptionGroup(OSError), the `err` variable would be
> an ExceptionGroup instance, which does not have an `errno` attribute.
>
> (Irit: Does the PEP answer this question? I couldn't quickly find it in
> the rejected ideas. I think it's a reasonable question and we should answer
> it, either in the Rationale or in Rejected Ideas.)
>
Added here: https://github.com/python/peps/pull/1846
>
_______________________________________________
Python-Dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/[email protected]/message/K7VCM7OZDIGZDTIZGJZJGWJOBXB65IU4/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to