[Tutor] passing a function's name to another function

Mallett, Roger rmallett@rational.com
Mon, 27 Nov 2000 11:38:43 -0800


> I would like to pass the name of a function to another function.  However,
> since the function's name may change I would like to pass a variable
> rather than a hardcoded name.
> 
> I look in the help file and discovered a reference to an obsolete function
> named codehack.  It apparently has been replaced by "func.func_name".  The
> problem is I want the liberty to change the function's name without having
> to change "func.func_name" as well.
> 
> 
> For example, I have two functions, one named "Test" and one named
> "NotImplementedYet".  I would like to have the freedom to change the name
> of "Test" without having to change the argument it passes to
> NotImplementedYet.  So, if I change the name of "Test" to "Apple" I don't
> want to have to change "Test.func_name" to "Apple.func_name".
> 
> 
> def NotImplementedYet(funcname):
> 	print funcname, 'is Not Implemented Yet'
> 
> 
> 
> def Test():
> 	NotImplementedYet(Test.func_name)  <<--it is the "Test" which
> produces the maintenance issue
> 
> 
> 
> What might I use?
> 
> Roger Mallett
> 
> 
> 
>