[Python-Dev] PEP 344: Explicit vs. Implicit Chaining

Phillip J. Eby pje at telecommunity.com
Sat May 21 00:37:16 CEST 2005


At 05:33 PM 5/20/2005 -0400, James Y Knight wrote:
>I still don't see why people think the python interpreter should be
>automatically providing __context__.

Because it's a pain when you have an error in your error handler, and are 
thus unable to debug the original.  (pdb isn't always an option, either; 
see later below)


>To me it seems like it'll just
>clutter things up for no good reason.

Only in cases like this:

     def __getattr__(self,attr):
         try:
             return self.__extras[attr]
         except KeyError:
             raise AttributeError

And in that particular case it's only adding a 1-line traceback.  I haven't 
thought of any more complex examples yet.


>  If you really want the other
>exception, you can access it via the local variable in the frame
>where it was first caught. Of course right now you don't get a
>traceback, but the proposal fixes that.

This only helps if you can get to a debugger.  What if you're reading your 
web server's error log?



More information about the Python-Dev mailing list