ndtools.comparison.operators module#

ndtools.comparison.operators.eq(left: T, right: Any, /) T[source]#

Implement the == operator for multidimensional arrays.

If left does not implement the __eq__ method, it will fall back to an equivalent implementation using another comparison operators.

Parameters:
  • left – Left hand side of the operator.

  • right – Right hand side of the operator.

Returns:

Result of left == right.

Raises:

AttributeError – Raised if no comparison operator is defined for left == right.

ndtools.comparison.operators.ge(left: T, right: Any, /) T[source]#

Implement the >= operator for multidimensional arrays.

If left does not implement the __ge__ method, it will fall back to an equivalent implementation using another comparison operators.

Parameters:
  • left – Left hand side of the operator.

  • right – Right hand side of the operator.

Returns:

Result of left >= right.

Raises:

AttributeError – Raised if no comparison operator is defined for left >= right.

ndtools.comparison.operators.gt(left: T, right: Any, /) T[source]#

Implement the > operator for multidimensional arrays.

If left does not implement the __gt__ method, it will fall back to an equivalent implementation using another comparison operators.

Parameters:
  • left – Left hand side of the operator.

  • right – Right hand side of the operator.

Returns:

Result of left > right.

Raises:

AttributeError – Raised if no comparison operator is defined for left > right.

ndtools.comparison.operators.le(left: T, right: Any, /) T[source]#

Implement the <= operator for multidimensional arrays.

If left does not implement the __le__ method, it will fall back to an equivalent implementation using another comparison operators.

Parameters:
  • left – Left hand side of the operator.

  • right – Right hand side of the operator.

Returns:

Result of left <= right.

Raises:

AttributeError – Raised if no comparison operator is defined for left <= right.

ndtools.comparison.operators.lt(left: T, right: Any, /) T[source]#

Implement the < operator for multidimensional arrays.

If left does not implement the __lt__ method, it will fall back to an equivalent implementation using another comparison operators.

Parameters:
  • left – Left hand side of the operator.

  • right – Right hand side of the operator.

Returns:

Result of left < right.

Raises:

AttributeError – Raised if no comparison operator is defined for left < right.

ndtools.comparison.operators.ne(left: T, right: Any, /) T[source]#

Implement the != operator for multidimensional arrays.

If left does not implement the __ne__ method, it will fall back to an equivalent implementation using another comparison operators.

Parameters:
  • left – Left hand side of the operator.

  • right – Right hand side of the operator.

Returns:

Result of left != right.

Raises:

AttributeError – Raised if no comparison operator is defined for left != right.