Closed rpanderson closed 4 years ago
Sweet. Fixes #56
This introduced a bug when arrays[0]
is an array.
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
I've never had a good rule for what to use in this situation. Neither any() or all() is approriate, and we don't want to do a typecheck on it being an int since it's allowed to be float zero as well.
Maybe
if not isinstance(arrays[0], np.ndarray) and arrays[0] == 0:
Ah,
if np.array_equal(arrays[0], 0):
appears to do the trick
Always returns False
for differing shapes, and for scalars is equivalent to ==
. I think it's the right solution.
These elicit a
SyntaxWarning
since Python 3.8 (explanation).