I would assume:
import numpy as np
a = np.array(["a", "b", "c"])
print(a == "abc")
print("abc" == a)
to output
[False False False]
False
, because the latter comparison should use the definition of equality for strings and the former should use the definition of equality for NumPy arrays.
The real output is:
[False False False]
[False False False]
Why does this happen[1] and how would one prevent it[2]?
[1] I.e. why is str.__eq__ NotImplemented?
[2] I.e. how can one call the equality check that was performed if np.ndarray.__eq__ would not be implemented?
[Edit] This question was marked as possible duplicate to comparing a string 1-d numpy array elementwise, which it is not, because there the exact opposite is asked (basically how to use np.ndarray.__eq__), and neither [1] nor [2] are discussed at all.