M.E.Farmer wrote:

def fun(d):

... __dict__ = d ... return __dict__ hth,


Does not work?

>>> a = { 'x':1, 'y':2}
>>> b = { 'x':2, 'y':9}
>>> def fun(d):
...   __dict__ = d
...   print locals()
...   z = x + y
>>> fun(a)
{'__dict__': {'y': 2, 'x': 1}, 'd': {'y': 2, 'x': 1}}
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "/usr/tmp/python-6377tax.py", line 4, in fun
NameError: global name 'x' is not defined
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to