Pearu Peterson write:
> On Mon, 9 Dec 2002, Perry Greenfield wrote:
>
> > >>> array_equal(array([[1,2,3],[1,2,3]]), array([1,2,3]))
> > 1
>
> Hmm, I would have expected 0.
> What's the rationale for 1?
>
Because the arrays can be broadcast into a consistent
array. In other words
equals(array([[1,2,3],[1,2,3]]), array([1,2,3])
returns
array([[1,1,1],[1,1,1]])
But I take your meaning. There may be those that wish
to ensure that two arrays are really identical in shape
and have all equal values. Should these be two different
functions? One function with different options.
By the way, I'm open to better function names as Tim Hochberg
suggests.
> May be you meant
>
> >>> array_equal(array([[1,2,3]]), array([1,2,3]))
> 1
>
> which I would agree. Also
>
> >>> array_equal(array([[1],[2],[3]]), array([1,2,3]))
> 1
>
> but I am not sure about
>
> >>> array_equal(array([[1,2,3],[1,2,3]]), array([1,2,3,1,2,3]))
> 1
>
> Pearu
Perry
|