Hi,

has anyone an idea why the following code does not work.


s = """
def a(n):
  return n*n


def b(t):
  return a(t)
"""


ns = {}
exec(s, {}, ns)
eval("b(2)", ns, {})


executing this script raises an exception (NameError: global name 'a'
is not defined) in the last line. 


Hope for your help.

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

Reply via email to