Closed as not planned
Description
Using ruff 0.0.265.
In this code, the two if-blocks are NOT equivalent:
def f(x):
# x is a np.ndarray with at least 2 dimensions
return x[0, 0] > 0
x = np.eye(2)
a = f(x)
if a == True:
print("a==True")
if a is True:
print("a is True")
assert(False)
What's going on is type(a)==numpy.bool_
which can be compared to True/False via ==
but it is not referentially the same.
Metadata
Metadata
Assignees
Labels
No labels