Am 01.02.2012 18:36, schrieb Dave Angel:
> def f(a):
>     from math import sin, cos
>     return sin(a) + cos(a)
> 
> print f(45)
> 
> Does what you needed, and neatly.  The only name added to the global
> namspace is f, of type function.

I recommend against this approach. It's slightly slower and the global
import lock will cause trouble if you start using threads.

Christian

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

Reply via email to