[Tutor] introspecting an object for method's name?

Alan Gauld alan.gauld at btinternet.com
Mon Oct 19 01:35:47 CEST 2009


"Serdar Tumgoren" <zstumgoren at gmail.com> wrote 

> Is there a way to dynamically grab the name of the method? E.g.,
> "get_name" in the above class.
> 

There may be more direct or easier ways but the traceback moduile 
lets you inspect the call stack to see what the current method or 
function is. Thats how Python produces its error message traceback...

Alan G.



More information about the Tutor mailing list