Bruno Desthuilliers <[EMAIL PROTECTED]> writes: > Gabriel Genellina a écrit : >> En Sun, 18 May 2008 17:31:44 -0300, Diez B. Roggisch >> <[EMAIL PROTECTED]> escribió: >>> Agustin Villena schrieb: >> >>>> is there anyway to show the class of a method in an exception's >>>> traceback? >>>> >>>> I want to improve the line File "G:\dev\exceptions\sample.py", >>>> line 3, in foo >>>> >>>> to File "G:\dev\exceptions\sample.py", line 3, in Some.foo >>>> >>>> Is this improvement feasible >>> It should be. You can get a dictionary of the locals of an >>> exception stack frame, of which you could extract the >>> self-parameter's class. >> >> That by itself is not enough, the method could be inherited; one >> should walk the base classes in the MRO to find the right one. And >> deal with classmethods and staticmethods. And decorators that don't >> preserve meta information... > > And monkeypatches. > >> Hmmm, I think it isn't so trivial as it >> seems. > > And not that useful - why would one care about the function being > defined in class X or Y when one have the exact file and line ?
Very obvious I would think. One can develop ones own interactive class browser and code navigator. One can not bring up class help from "line 3 in x.py" but one can from "classname : MyClass at line 2 in z.py". With the class name I can navigate directly to all sorts of class related information without the need to delve into a physical usage of it e.g program.py at line 3. -- http://mail.python.org/mailman/listinfo/python-list