Hello,
I would like to create a
Olivier
I would like to create a
lambda
function accessing Numpy functions, and only them. I can do the following:import numpy eval('exp(1)', {'__builtins__': None}, numpy.__dict__)
Output:2.7182818284590451
However, I get an error when I create a lambda
function in that way:f = eval('lambda x:exp(1)', {'__builtins__': None}, numpy.__dict__) f(0)
Error:TypeError: 'NoneType' object is not subscriptable
Could you explain why and provide a working example?Olivier