Re: Suppressing __context__

2010-10-29 Thread Martin v. Loewis
> 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 KeyEr

Re: Suppressing __context__

2010-10-29 Thread Antoine Pitrou
On Fri, 29 Oct 2010 04:07:15 -0700 Chris Rebert wrote: > On Fri, Oct 29, 2010 at 4:02 AM, Antoine Pitrou wrote: > > On Sun, 24 Oct 2010 10:48:23 +0200 > > "Martin v. Loewis" wrote: > >> > >> You may now wonder whether it is possible to set __context__ to None > >> somehow. See PEP 3134: > >> >

Re: Suppressing __context__

2010-10-29 Thread Chris Rebert
On Fri, Oct 29, 2010 at 4:02 AM, Antoine Pitrou wrote: > On Sun, 24 Oct 2010 10:48:23 +0200 > "Martin v. Loewis" wrote: >> >> You may now wonder whether it is possible to set __context__ to None >> somehow. See PEP 3134: >> >> Open Issue: Suppressing Context >> >>     As written, this PEP makes i