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 ncoghlan
Recipients ncoghlan, steven.daprano
Date 2017-06-29.02:43:10
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1498704190.87.0.13904092478.issue30792@psf.upfronthosting.co.za>
In-reply-to
Content
Also clarifying a point that came up later in the thread [1]: one of the motivating examples that came up in the thread was the idea of using this to catch AttributeError exceptions in property and __getattr__ implementations and convert them to RuntimeError.

I don't actually think that's a good use case: using a static analysis tool like 'pylint -E' or mypy, or the builtin error checking in an advanced IDE like PyCharm is a much better approach to detecting that kind of problem.

Instead, the valid use cases I see for runtime exception conversion are in:

- framework development, where you're invoking arbitrary code that you didn't write and want to ensure it can't falsely trigger an exception based event reporting protocol (this is the PEP 479 use case, and we may end up doing this for the exec_module() hook in the import system as well)

- adapting between two different exception based event reporting protocols (e.g. KeyError <-> AttributeError, StopIteration -> AsyncStopIteration)

[1] https://mail.python.org/pipermail/python-ideas/2017-June/046234.html
History
Date User Action Args
2017-06-29 02:43:10ncoghlansetrecipients: + ncoghlan, steven.daprano
2017-06-29 02:43:10ncoghlansetmessageid: <1498704190.87.0.13904092478.issue30792@psf.upfronthosting.co.za>
2017-06-29 02:43:10ncoghlanlinkissue30792 messages
2017-06-29 02:43:10ncoghlancreate