[SciPy-dev] logical array TypeError

Travis Oliphant oliphant at ee.byu.edu
Thu Nov 3 10:54:27 EST 2005


Robert Cimrman wrote:

>In [2]:a = scipy.rand(10 )
>In [3]:a
>Out[3]:
>array([ 0.70999964,  0.33431269,  0.64182382,  0.5041205 ,  0.58857909,
>         0.83947773,  0.4660244 ,  0.72767477,  0.73517386,  0.66661387])
>
>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.

-Travis




More information about the SciPy-Dev mailing list