On Mon, Jul 7, 2008 at 9:30 AM, Keith Goodman <[EMAIL PROTECTED]> wrote:
> I'm writing the doc string for array_equal. From the existing one-line
> doc string I expect array_equal to return True or False. But I get
> this:
>
>>> np.array_equal([1,2], [1,2])
> True
>>> np.array_equal([1,2], [1,2,3])
> 0
>>> np.array_equal(np.array([1,2]), np.array([1,2,3]))
> 0
>>> np.__version__
> '1.1.0'
Oh, it's written in python:
def array_equal(a1, a2):
"""Returns True if a1 and a2 have identical shapes
and all elements equal and False otherwise.
"""
try:
a1, a2 = asarray(a1), asarray(a2)
except:
return 0
if a1.shape != a2.shape:
return 0
return logical_and.reduce(equal(a1,a2).ravel())
Could someone change the 0's to False? Otherwise it will return True,
False or 0.
>> np.array_equal([3,2], [1,2])
False
_______________________________________________
Numpy-discussion mailing list
[email protected]
http://projects.scipy.org/mailman/listinfo/numpy-discussion