I'm building a simple parser that should be able to read some logic and arithmetic, compile it into an AST, then evaluate it. In an effort to do so without using the evil eval
, I came across this answer.
Then I realized, the builtin operator
library has functions for almost everything, except the logical and
and or
, only the bitwise ones exist. Surprisingly, logical not
also exists. Why is and
and or
missing? Why not
but not and
and or
? And to follow the mentioned above answer, what function should I use for those two operators?
PS: I was checking for python3, but it looks like the same library in python2 has the same issue.