Python Decorators Resource (not a question, just a resource)
-
This is for more the beginners like me. Below is a link to The PythonDecroratorLibrary. I haven't seen this before. I still have trouble getting my head around decorators. Not sure why, I just do. This source may help and inspire me. There are a ton of ready to use decorators here.
I just starting using this onE. It's great for debugging.
Anyway, just thought I would share. Looks to be many useful decorators there
def dump_args(func): "This decorator dumps out the arguments passed to a function before calling it" argnames = func.func_code.co_varnames[:func.func_code.co_argcount] fname = func.func_name def echo_func(*args,**kwargs): print fname, ":", ', '.join( '%s=%r' % entry for entry in zip(argnames,args) + kwargs.items()) return func(*args, **kwargs) return echo_func