C
Christopher J. Bottaro
I want to get the name of the function from within the function. Something
like:
def myFunc():
print __myname__'myFunc'
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):
print get_args_as_tuple()(1, 2, 3)
I don't want to use
def f(*args):
print args
because I want to keep the error checking capability that comes with using a
fixed number of positional args.
Thank you for the help.
like:
def myFunc():
print __myname__'myFunc'
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):
print get_args_as_tuple()(1, 2, 3)
I don't want to use
def f(*args):
print args
because I want to keep the error checking capability that comes with using a
fixed number of positional args.
Thank you for the help.