Simplify an expression
@@ -3209,8 +3209,7 @@ cpdef _scatter_op(ndarray a, slices, value, op):
cpdef ndarray _diagonal(ndarray a, Py_ssize_t offset=0, Py_ssize_t axis1=0,
Py_ssize_t axis2=1):
cdef Py_ssize_t ndim = a.ndim
- if (axis1 >= ndim or axis2 >= ndim or
- axis1 < - ndim or axis2 < - ndim):
+ if not (-ndim <= axis1 < ndim and -ndim <= axis2 < ndim):
raise ValueError('axis1(={0}) and axis2(={1}) must be within range '
'(ndim={2})'.format(axis1, axis2, ndim))
