NumExpr: Bitwise AND not working with variable

61 Views Asked by At

I'm using python 3.8.10 with numexpr 2.8.4 and want to evaluate an expression containing a bitwise AND.

But the following code fails with NotImplementedError: couldn't find matching opcode for 'and_bli'

import numexpr as ne
r = ne.evaluate('(a&2)', {'a': 11})  # FAILS
print(r)

But when I eliminate the variable, it works as expected:

import numexpr as ne
r = ne.evaluate('(11&2)')
print(r)  # prints 2

What do I need to change to make above code working?

0

There are 0 best solutions below