Here you go. Unfortunate that you can't modify locals() easily, but there are other options.
def foo(d):
for k in d:
exec '%s = %s' % (k, repr(d[k]))
print a + b
foo({'a':1, 'b':2})
--
http://mail.python.org/mailman/listinfo/python-list
Here you go. Unfortunate that you can't modify locals() easily, but there are other options.
def foo(d):
for k in d:
exec '%s = %s' % (k, repr(d[k]))
print a + b
foo({'a':1, 'b':2})
--
http://mail.python.org/mailman/listinfo/python-list