Creating function object from text

Edward C. Jones edcjones at erols.com
Sat Apr 17 12:21:30 EDT 2004


Suppose I have a piece of text that defines a function:

text ="""\
def fun(i):
     return i + 2
"""

How do I turn this into a function object, f, which can be called or 
passed around?



More information about the Python-list mailing list