PyTables/PyTables — pull request #241 by scopatz (2013-04-27 01:34:09+00:00)
Title: Upgrade for numexpr 2.1rc3

This closes PyTables/PyTables#199 and PyTables/PyTables#199.

Additionally, the ``_equiv_expr_node()`` function in conditions.py (see below) should be considered for inclusion in numexpr. It tests if two NodeExpressions are equivalent. This is needed since the NodeExpression.__eq__() method now returns another NodeExpression rather than a bool. If this function is moved over and made part of the numexpr public API, then we will remove this from PyTables.

Lastly, when I run the tests with numpy master I see some DeprecationWarnings that I believe are coming from numexpr (see below). I don't think that these should prevent this PR from being merged in.

*function:*
```python
def _equiv_expr_node(x, y):
"""Returns whether two ExpressionNodes are equivalent. This is needed
because '==' is overridden on ExpressionNode to return a new ExpressionNode.
"""
if not isinstance(x, ExpressionNode) and not isinstance(y, ExpressionNode):
return x == y
elif type(x) is not type(y) or not isinstance(x, ExpressionNode) \
or not isinstance(y, ExpressionNode) \
or x.value != y.value or x.astKind != y.astKind \
or len(x.children) != len(y.children):
return False
for xchild, ychild in zip(x.children, y.children):
if not _equiv_expr_node(xchild, ychild):
return False
return True
```

*warning:*
```bash
/home/scopatz/.local/lib/python2.7/site-packages/numexpr-2.1_rc3-py2.7-linux-x86_64.egg/numexpr/necompiler.py:746: DeprecationWarning: using `oa_ndim == 0` when `op_axes` is NULL is deprecated. Use `oa_ndim == -1` or the MultiNew iterator for NumPy <1.8 compatibility
return compiled_ex(*arguments, **kwargs)
```