This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author rhettinger
Recipients JelleZijlstra, iritkatriel, rhettinger
Date 2022-01-10.19:57:22
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1641844643.08.0.886089220568.issue46330@roundup.psfhosted.org>
In-reply-to
Content
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".
History
Date User Action Args
2022-01-10 19:57:23rhettingersetrecipients: + rhettinger, JelleZijlstra, iritkatriel
2022-01-10 19:57:23rhettingersetmessageid: <1641844643.08.0.886089220568.issue46330@roundup.psfhosted.org>
2022-01-10 19:57:23rhettingerlinkissue46330 messages
2022-01-10 19:57:23rhettingercreate