Terry J. Reedy tjre...@udel.edu added the comment:
Questions should be asked on python-list or other discussion forums, not nere.
If this were a feature-request, it would need a realistic use-case. If the
implied change were requested, I would think it should be rejected as
conflicting with
Ram Rachum cool...@cool-rr.com added the comment:
Also, how important is the performance of exception checking *after* an
exception was raised? I mean, wouldn't it matter only for programs that raise
and catch hundreds of exceptions a second?
--
Benjamin Peterson benja...@python.org added the comment:
It matters when exceptions are expected or are a normal part of control flow.
For example StopIteration.
--
nosy: +benjamin.peterson
___
Python tracker rep...@bugs.python.org
New submission from Ram Rachum cool...@cool-rr.com:
Is there a reason why `execpt` compares base classes instead of using
`isinstance`? This prevents using `__instancecheck__` to override the instance
check.
--
components: Interpreter Core
messages: 117844
nosy: cool-RR
priority:
Antoine Pitrou pit...@free.fr added the comment:
Mainly to protect against potential infinite recursion with isinstance checks.
Also, performance is probably better.
Here are the relevant code and comments in PyErr_GivenExceptionMatches() (in
Python/errors.c):
/*
Ram Rachum cool...@cool-rr.com added the comment:
I don't understand the infinite recursion argument. If there's such an infinite
recursion, wouldn't it be due to a bug in the user's implementation of
__instancecheck__?
--
___
Python tracker