The solution for the problem I previously posted this month.
Of course, I had eval() in my mind:
>>> import math
>>> x=1.234
>>> s=str(eval("math.sin(x)"))
>>> s
'0.9438182093746337'
>>> s=str(eval("math.sin(1.234)"))
>>> s
'0.9438182093746337'
>>>
Warning: it's to be used with care...

Yes, I know about these lousy Disqus ads. Please use adblocker. I would consider to subscribe to 'pro' version of Disqus if the signal/noise ratio in comments would be good enough.