Is there a way to preserve the argspec of a function after wrapping it
in a closure?

I'm looking for a general way to say "wrap function F in a closure",
such that inspect.getargspec on the closure would return the same
(args, varargs, varkw, defaults)  tuple ass the enclosed function.

The typical code I'm using is something like this:

def wrapFunc(func):
    def tmpWrapper(*args, **kwargs):
        return func(*args, **kwargs)
    tmpWrapper.func_name = func.func_name
    return wrapFunc

This preserves the function name - how do I do more?

vic

-- 
"Never attribute to malice that which can be adequately explained by
stupidity."  - Hanlon's Razor
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to