safe eval of moderately simple math expressions

Terry Reedy tjreedy at udel.edu
Thu Apr 9 19:13:50 CEST 2009


Joel Hedlund wrote:
> Hi all!
> 
> I'm writing a program that presents a lot of numbers to the user, and I 
> want to let the user apply moderately simple arithmentics to these 
> numbers. One possibility that comes to mind is to use the eval function, 
> but since that sends up all kinds of warning flags in my head,

Where does the program execute?  If on the user's own machine, no 
problem.  Eval is no more dangerous than Python itself.




More information about the Python-list mailing list