Re: ALL function arguments in a common dictionary

2013-04-24 Thread Fábio Santos
A quick hack: >>> from inspect import getargspec >>> >>> def func(a, b, c=3, **kwargs): ... out_dict = {} ... args, _, keywords, _ = getargspec(func) ... for argname in args: ... out_dict[argname] = locals()[argname] ... if keywords: ... out_dict.update(locals()[key

ALL function arguments in a common dictionary

2013-04-24 Thread Wolfgang Maier
Hi everybody, what is the recommended way of stuffing *all* function arguments (not just the ones passed by **kwargs) into a common dictionary? The following sort of works when used as the first block in a function: try: kwargs.update(locals()) except NameError: kwargs = locals().copy() e