[Python-ideas] Use `isinstance` check during exception handling
Serhiy Storchaka
storchaka at gmail.com
Thu Nov 5 03:05:55 EST 2015
On 05.11.15 00:02, sjoerdjob at sjec.nl wrote:
> Now, PEP3151 took over a year to be resolved, judging by the dates. If
> we have to go through changes like this more often, one will have to
> wait quite a while. Also, consider backwards compatibility issues. Code
> using FileNotFoundError will only run on Python3.3+.
>
> Thus I propose to have the exception handling code use the normal
> `isinstance` machinery, as it is more powerful, and allows one to use
> virtual base classes to check if the instance of the exception is
> relevant to catch. An example:
>
> import errno
>
> # Fake `FileNotFoundError` in Python3.2
Do you propose to add a new feature in 3.2?
More information about the Python-ideas
mailing list