Skip to content Skip to sidebar Skip to footer

SymPy: Safely Parsing Strings

SymPy comes equipped with the nice sympify() function which can parse arbitrary strings into SymPy expressions. But it has two major drawbacks: It is not safe, as it relies on the

Solution 1:

Look at the internal functions in the SymPy parsing module.

There is no official way to do it. We need to rewrite sympify to avoid eval. Note that SymPy gamma just uses sympify. It remains safe because it's sandboxed on the App Engine.


Post a Comment for "SymPy: Safely Parsing Strings"