I understand that how *
and **
operators generally work. In the following code [ taken from django's source ]
def curry(_curried_func, *args, **kwargs):
def _curried(*moreargs, **morekwargs):
return _curried_func(*(args + moreargs), **dict(kwargs, **morekwargs))
return _curried
I get how the args + moreargs
part work - the [non - keyword ] arguments passed initially to the function curry
and the arguments passed to the curried function returned by curry
are combined. What I don't get is how the **dict(kwargs, **morekwargs)
works. Could someone please explain that bit?