Works in python 2.4 and 2.5
1 2 3 4 5 6 7
def f(**kw): for k,v in kw.iteritems(): locals()[k]=v exec('pass') # apply locals %) print x f(x='test')