1 def dump_args(func): 2 "This decorator dumps out the arguments passed to a function before calling it" 3 argnames = func.func_code.co_varnames[:func.func_code.co_argcount] 4 fname = func.func_name 5 def echo_func(*args,**kwargs): 6 print fname, ":", ', '.join( 7 '%s=%r' % entry 8 for entry in zip(argnames,args) + kwargs.items()) 9 return func(*args, **kwargs) 10 return echo_func 11 12 @dump_args