my code example imitate 'memoize' function in django.utils.functional.py,why error
<pre><code>def a():
    print 'aa'
def b():
    print 'bb'

def c(*x):
    print x

def d(x,y):
    c(*(x+y))

d(a,b)

Traceback (most recent call last):
  File "D:\zjm_code\mysite\zjmbooks\a.py", line 15, in &lt;module&gt;
    d(a,b)
  File "D:\zjm_code\mysite\zjmbooks\a.py", line 13, in d
    c(*(x+y))
TypeError: unsupported operand type(s) for +: 'function' and 'function'
</code></pre>

<p>the code in django.utils.functional.py:</p>

<pre><code>def curry(_curried_func, *args, **kwargs):
    def _curried(*moreargs, **morekwargs):
        return _curried_func(*(args+moreargs), **dict(kwargs, **morekwargs))
    return _curried

WRAPPER_ASSIGNMENTS = ('__module__', '__name__', '__doc__')
WRAPPER_UPDATES = ('__dict__',)
def update_wrapper(wrapper,
                   wrapped,
                   assigned = WRAPPER_ASSIGNMENTS,
                   updated = WRAPPER_UPDATES):
    for attr in assigned:
        try:
            setattr(wrapper, attr, getattr(wrapped, attr))
        except TypeError: # Python 2.3 doesn't allow assigning to __name__.
            pass
    for attr in updated:
        getattr(wrapper, attr).update(getattr(wrapped, attr))
    return wrapper

def wraps(wrapped,
          assigned = WRAPPER_ASSIGNMENTS,
          updated = WRAPPER_UPDATES):
    return curry(update_wrapper, wrapped=wrapped,
                 assigned=assigned, updated=updated)

### End from Python 2.5 functools.py ##########################################

def memoize(func, cache, num_args):
    def wrapper(*args):
        mem_args = args[:num_args]
        if mem_args in cache:
            return cache[mem_args]
        result = func(*args)
        cache[mem_args] = result
        return result
    return wraps(func)(wrapper)
</code></pre>

<hr>

<p>my Analysis:</p>

<pre><code>def curry(update_wrapper, *args, **kwargs):
    def _curried(*wrapper, **morekwargs):
        return update_wrapper(wrapper,{wrapped:func})#this is the result
    return _curried
def update_wrapper(wrapper,wrapped)

def wraps(func):
    return curry(update_wrapper, wrapped=func)

wraps(func)(wrapper)
</code></pre>
