On 2020-02-23 16:00, João Matos wrote:
Hello,

Can't you use eval()?

This
return eval(expr)

instead of
return expr.evaluate()

You can use eval if expr is a string, but then you have the same problems that were mentioned in a recent thread about "SQL strings": it's not syntax-highlighted, syntax errors aren't caught until you eval it, etc. You can't use eval for the case I described because there isn't any Python object like the unevaluated expression that I called `expr`.

--
Brendan Barnwell
"Do not follow where the path may lead. Go, instead, where there is no path, and leave a trail."
   --author unknown
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/TFTUQK52CGJNMRJYCEXUP4QHOUN5OFKJ/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to