Hi,

Is there a better way to unpack more than one dictionary in a function
than...

def unpack_dicts(f):
    def wrapper(*old_dicts):
        dict={}
        for d in old_dicts:
            dict.update(d)
        return f(**dict)
    return wrapper

@unpack_dicts
def some_func(a=None, b=None, c=None):
    print a, b, c

d1 = {'a': 20.0, 'b': '-1'}
d2 = {'c': 33.0}

some_func(d1, d2)

thanks
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to