I want to write a decorator that, among other things, returns a
function that has one additional keyword parameter, say foo=None.

When I try

def my_decorator(f):
    # blah, blah
    def wrapper(*p, foo=None, **kw):
        x = f(*p, **kw)
        if (foo):
            # blah, blah
        else
            # blah blah
    return wrapper 

...i get a syntax error where it says "foo=None".  I get similar
errors with everything else I've tried.

Is is possible to do this in Python?

TIA!

kynn

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

Reply via email to