how to get name of function from within function?
Christopher J. Bottaro
cjbottaro at alumni.cs.utexas.edu
Fri Jun 3 23:17:00 CEST 2005
I want to get the name of the function from within the function. Something
Really what I want to do is to easily strip off the prefix of a function
name and call another function. Like this:
def prefix_myFunc(a, b, c):
name = __myname__[7:]
call(name, a, b, c)
That would call myFunc(a, b, c).
How do I accomplish this 'elegantly', err...'pythonicly'..=)
Also, is there a way to turn normal positional args into a tuple without
using *? Like this:
def f(a, b, c):
>>> f(1, 2, 3)
(1, 2, 3)
I don't want to use
because I want to keep the error checking capability that comes with using a
fixed number of positional args.
Thank you for the help.
More information about the Python-list