[SciPy-dev] logical array TypeError

Robert Cimrman cimrman3 at ntc.zcu.cz
Thu Nov 3 10:16:26 CST 2005


Travis Oliphant wrote:
> Robert Cimrman wrote:
> 
>>In [4]:b = a > 0.2
>>In [5]:b
>>Out[5]:array([True, True, True, True, True, True, True, True, True, 
>>True], dtype=bool)
>>
>>In [6]:b.dtype()
>>---------------------------------------------------------------------------
>>exceptions.TypeError                                 Traceback (most 
>>recent call last)
>> 
>>
> 
> b.dtype   (no parenthesis) is what you are looking for.
> 
> Attributes are different from methods.
> 
> b.dtype() is trying to call the bool_ array scalar type object (which is 
> the b.dtype attribute) thus it needs an argument.

Thanks! I was fooled by the fact that a.dtype() did not raise an 
exception for a non-bool array.

r.




More information about the Scipy-dev mailing list