j: Next unread message
k: Previous unread message
j a: Jump to all threads
j l: Jump to MailingList overview
On 27 June 2017 at 02:29, Sven R. Kunze email@example.com wrote:
On 24.06.2017 01:37, MRAB wrote: >
I think a "shallow exception" would be one that's part of a defined API, as distinct from one that is an artifact of the implementation, a leak in the abstraction.
I like the "shallow exception" idea most. It's simple and it covers most if not all issues. You also hit the nail with pointing to leaking abstractions.
The shallow exception notion breaks a fairly fundamental refactoring principle in Python: you should be able to replace an arbitrary expression with a subfunction or subgenerator that produces the same result without any of the surrounding code being able to tell the difference.
By contrast, Steven's exception_guard recipe just takes the existing "raise X from Y" feature, and makes it available as a context manager and function decorator.
-- Nick Coghlan | firstname.lastname@example.org | Brisbane, Australia