[Python-ideas] exception instantiation philosophy and practice [was: Let try-except check the exception instance]
Guido van Rossum
guido at python.org
Thu May 31 10:53:43 EDT 2018
On Thu, May 31, 2018 at 7:49 AM, Ethan Furman <ethan at stoneleaf.us> wrote:
> On 05/31/2018 07:36 AM, Nick Coghlan wrote:
>
> The exception machinery deliberately attempts to avoid instantiating
>> exception objects whenever it can, but that gets
>> significantly more difficult if we always need to create the instance
>> before we can decide whether or not the raised
>> exception matches the given exception handler criteria.
>>
>
> Why is this? Doesn't the exception have to be instantiated at some point,
> even if just to print to stderr?
>
Not if it gets caught and ignored.
--
--Guido van Rossum (python.org/~guido)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20180531/f27cbd19/attachment.html>
More information about the Python-ideas
mailing list