#--- file bar.py
def negate(n):
return -n
def square(n):
return n*n
#--- end bar.py
>>> foo="bar"
>>> fs=__import__(foo)
>>> import types
>>> f=[a for a in dir(fs) if a[0:2]!='__' and
type(getattr(fs,a))==types.FunctionType]
>>> f
['negate', 'square']
>>> n=5
>>> exec("print fs."+f[0]+"(n)")
-5
>>> exec("print fs."+f[1]+"(n)")
25
Isn't the problem solved?
--
http://mail.python.org/mailman/listinfo/python-list
