On 28.06.2017 08:00, Nick Coghlan
Right, and I'd like us to keep in mind the KeyError -> AttributeError
(and vice-versa) use case as well. Similar to ExitStack, it would be
appropriate to make some additions to the "recipes" section in the
docs that covered things like "Keep AttributeError from being
suppressed in a property implementation".
As it was snipped away, let me ask again:
I don't see how this helps differentiating shallow and nested
exceptions such as:
except RuntimeError: # catches shallow and nested ones
import fallbacks.MySpecialLib as myspeciallib
At least in my tests, exception_guard works this way and I don't see
any improvements to current behavior. Moreover, I am somewhat
skeptical that using this recipe will really improve the situation.
It's a lot of code where users don't have any stdlib support. I
furthermore doubt that all Python coders will now wrap their
properties using the guard. So, using these properties we will have
almost no improvement. I still don't see it as the responsibility of
coder of the property to guard against anything. Nobody is forced to
catch exceptions when using a property.
If that's the "best" outcome, I will stick to
because 1) Google finds it for me and 2) we don't have to maintain
100 lines of code ourself.