danthedeckie / simpleeval

Simple Safe Sandboxed Extensible Expression Evaluator for Python
Other
451 stars 85 forks source link

Possible to define my own operators #84

Closed MayamaTakeshi closed 3 years ago

MayamaTakeshi commented 3 years ago

Hi, I'm trying to use simpleeval to evaluate expressions as XML attributes. Since XML syntax uses "<" and ">" I cannot do this:

  <Tag expr="3 > 1"/>

So I am trying to use something like this:

  <Tag expr="3 GT 1"/>

Can this be done?

MayamaTakeshi commented 3 years ago

Ah, I saw #26 and from there I found the CustomOperators.py demo. Sorry for the noise.