Can I undecorate a function?

Matthew Wilson matt at tplus1.com
Mon Jan 29 12:17:19 EST 2007


The decorator as_string returns the decorated function's value as
string.  In some instances I want to access just the function f,
though, and catch the values before they've been decorated.

Is this possible?

def as_string(f):
    def anon(*args, **kwargs):
        y = f(*args, **kwargs)
        return str(y)
    return anon

@as_string
def f(x):
    return x * x

Matt


-- 
A better way of running series of SAS programs:
http://overlook.homelinux.net/wilsonwiki/SasAndMakefiles



More information about the Python-list mailing list