> It is not easily discoverable, but it is possible to suppress
> __context__ by using a bare re-raise afterwards:
I see. I'd wrap this like this:
def raise_no_context(e):
try:
raise e
except:
e.__context__=None
raise
d = {}
try:
val = d['nosuch']
except KeyError:
raise_no_context(AttributeError("No attribute 'nosuch'"))
The downside of this is that the innermost frame will be
raise_no_context, but I suppose that's ok because even the
next-inner frame already reveals implementation details that
developers have learned to ignore.
Regards,
Martin
--
http://mail.python.org/mailman/listinfo/python-list