How to get all named args in a dict?

kj socyl at
Wed May 13 17:50:41 EDT 2009

Suppose I have the following:

def foo(x=None, y=None, z=None):
    d = {"x": x, "y": y, "z": z}
    return bar(d)

I.e. foo takes a whole bunch of named arguments and ends up calling
a function bar that takes a single dictionary as argument, and this
dictionary has the same keys as in foo's signature, so to speak.

Is there some builtin variable that would be the same as the variable
d, and would thus obviate the need to explicitly bind d?



NOTE: In my address everything before the first period is backwards;
and the last period, and everything after it, should be discarded.

More information about the Python-list mailing list