@@ -1535,8 +1535,8 @@ def __eq__(left, right): # lgtm[py/not-named-self] pylint: disable=no-self-argu
1535
1535
========= ========== ==== ================================
1536
1536
1537
1537
"""
1538
- assert type (left ) == type (right ), "operands to == are of different types"
1539
- return left . _op2 ( right , lambda x , y : np . allclose ( x , y ) )
1538
+ return (left . _op2 (right , lambda x , y : np . allclose ( x , y ))
1539
+ if type ( left ) == type ( right ) else False )
1540
1540
1541
1541
def __ne__ (left , right ): # lgtm[py/not-named-self] pylint: disable=no-self-argument
1542
1542
"""
@@ -1563,7 +1563,8 @@ def __ne__(left, right): # lgtm[py/not-named-self] pylint: disable=no-self-argu
1563
1563
========= ========== ==== ================================
1564
1564
1565
1565
"""
1566
- return [not x for x in left == right ]
1566
+ eq = left == right
1567
+ return (not eq if isinstance (eq , bool ) else [not x for x in eq ])
1567
1568
1568
1569
def _op2 (
1569
1570
left , right , op
@@ -1581,8 +1582,8 @@ def _op2(
1581
1582
:return: list of matrices
1582
1583
:rtype: list
1583
1584
1584
- Peform a binary operation on a pair of operands. If either operand
1585
- contains a sequence the results is a sequence accordinging to this
1585
+ Perform a binary operation on a pair of operands. If either operand
1586
+ contains a sequence the results is a sequence according to this
1586
1587
truth table.
1587
1588
1588
1589
========= ========== ==== ================================
0 commit comments