numexpr
numexpr copied to clipboard
Operators not defined in Expression
In expressions.py, class ExpressionNode:
line 451: if sys.version_info[0] < 3: div = div_op rdiv = binop('div', reversed=True)
All fine, but the operators are not defined for Python 3. Leading to unexpected behavior in conjunction with for instance the floor division operator //
. Not that it is really necessary to define these particular div and rdiv, but I guess I'd like it if support for floor division can be added. Right now, it will raise "Unsupported operand type(s) for //: 'VariableNode' and 'VariableNode' "
__floordiv__
is the dunder in the module operations
so this isn't supported at all in NumExpr 2.6. After looking at it, I think the issue is somewhat more complicated than I would like because in C++ integer division is truncated, and in Python floor division is... floor division. This is something that's intended to be in NumExpr 3.0 but it doesn't work properly right now so I'll mull it over and implement something.
If I were to be fine with a truncating integer division (since I only expect positive integers), would it be possible to access it?
@cod3monk Not in the vanilla release numexpr
, no.
Message to comment on stale issues. If none provided, will not mark issues stale