[Tutor] print method name

Alan Gauld alan.gauld at btinternet.com
Thu Dec 8 20:05:30 CET 2011


On 08/12/11 14:49, rail shafigulin wrote:
> i created a class and in some instances when i use it call some of its
> methods i need to print a method name.

I'm curious why you need this?
In most cases if you call a method you know its name...

myObj = MyClass()
myObj.spam()
print "Just called MyClass.spam()"

This would only be useful if you were creating references to methods 
dynamically or using callbacks from asynchronous messages or something?

Just wondering what you are doing that requires this?

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/



More information about the Tutor mailing list