Dynamically pass a function arguments from a dict
Dan Eloff
dan.eloff at gmail.com
Wed Feb 23 23:04:27 EST 2005
Awesome, wrapping that into a function:
def getargs(func):
numArgs = func.func_code.co_argcount
names = func.func_code.co_varnames
return names[:numArgs]
short, concise, and it works :)
variables declared inside the function body are also in co_varnames
but after the arguments only it seems
A good module (huge, very comprehensive)
for this kinda thing can be found at:
http://lfw.org/python/inspect.py
Thanks very much!
-Dan
More information about the Python-list
mailing list