Christopher Barker wrote:
>
> Robert Kern wrote:
>
>>> What determines if an array tests for equality as the entire array or
>>> element-wise?
>> There are some special cases for backwards compatibility.
>
> with what?
>
> IIRC, Numeric has raised an error for a very long time with:
>
> a ==
Robert Kern wrote:
>> What determines if an array tests for equality as the entire array or
>> element-wise?
>
> There are some special cases for backwards compatibility.
with what?
IIRC, Numeric has raised an error for a very long time with:
a == None #(a is a Numeric array)
Personally,
Excellent. That explains it.
thank you Robert,
tim
Robert Kern wrote:
> Tim Hirzel wrote:
>
>> Thanks Robert.
>> That makes more sense now. Although I am still a little puzzled by the
>> equality behavior of an array. for example:
>>
>> >>> a = numpy.arange(5)
>> >>> None == a
>> False
>>
Tim Hirzel wrote:
> Thanks Robert.
> That makes more sense now. Although I am still a little puzzled by the
> equality behavior of an array. for example:
>
> >>> a = numpy.arange(5)
> >>> None == a
> False
>
> >>> 5 == a
> array([False, False, False, False, False], dtype=bool)
>
> >>> cla
Thanks Robert.
That makes more sense now. Although I am still a little puzzled by the
equality behavior of an array. for example:
>>> a = numpy.arange(5)
>>> None == a
False
>>> 5 == a
array([False, False, False, False, False], dtype=bool)
>>> class Empty:
pass
>>> e = Empty()
>>> e
Tim Hirzel wrote:
> Does this seem odd to anyone else? I am not sure about the
> implementation of 'in' but it seems like a comparison is going funny
> somewhere. Or I am missing something...
Yes, list.__contains__ uses equality to test for membership, not identity.
--
Robert Kern
"I have c
Hi All,
When a list contains a numpy array and I want to see if a value is a
member of that list, I can get a value error from numpy:
>>> import numpy
>>> numpy.__version__
'1.0'
>>> a = numpy.arange(10)
>>> L = [a]
>>> a in L
True
>>> 2 in L
Traceback (most recent call last):
File "", lin