ndtools.comparison.operators module#

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 (T) – Left hand side of the operator.

  • right (Any) – Right hand side of the operator.

Returns:

Result of left == right.

Raises:

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

Return type:

T

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 (T) – Left hand side of the operator.

  • right (Any) – Right hand side of the operator.

Returns:

Result of left >= right.

Raises:

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

Return type:

T

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 (T) – Left hand side of the operator.

  • right (Any) – Right hand side of the operator.

Returns:

Result of left > right.

Raises:

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

Return type:

T

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 (T) – Left hand side of the operator.

  • right (Any) – Right hand side of the operator.

Returns:

Result of left <= right.

Raises:

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

Return type:

T

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 (T) – Left hand side of the operator.

  • right (Any) – Right hand side of the operator.

Returns:

Result of left < right.

Raises:

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

Return type:

T

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 (T) – Left hand side of the operator.

  • right (Any) – Right hand side of the operator.

Returns:

Result of left != right.

Raises:

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

Return type:

T