Raymond Hettinger <raymond.hettin...@gmail.com> added the comment:

Implementation and transition issues aside, I like this idea.  People can 
mostly just use isinstance() checks to match one or more exception types.  
Also, the single argument form would work well with structural pattern matching:

    def __exit__(self, exc):
        match exc:
            case IOError():
                ...

That said, there will be some cases that are worse off.  If the code actually 
needs "exctype", perhaps for logging or for an exact match, then the new single 
argument form will just shift complexity away from the signature and into the 
main body of the code.  This may be the common case.  During code reviews, I 
see the "exctype" argument used more frequently than "excinst".

----------
nosy: +rhettinger

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue46330>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to