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 ?

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to