[NumPy-Tickets] [NumPy] #721: 0-dimensional boolean arrays should work as masks for array scalars

NumPy Trac numpy-tickets@scipy....
Tue Mar 22 22:26:32 CDT 2011


#721: 0-dimensional boolean arrays should work as masks for array scalars
-------------------------+--------------------------------------------------
  Reporter:  stefan      |       Owner:  oliphant   
      Type:  defect      |      Status:  closed     
  Priority:  normal      |   Milestone:  Unscheduled
 Component:  numpy.core  |     Version:  none       
Resolution:  fixed       |    Keywords:             
-------------------------+--------------------------------------------------
Changes (by mwiebe):

  * status:  new => closed
  * resolution:  => fixed


Comment:

 Currently:

 {{{
 In [15]: x = np.array(0)

 In [16]: m = np.array(True)

 In [17]: x[m]
 Out[17]: array(0)

 In [18]: m = np.array(False)

 In [19]: x[m]
 Out[19]: array([], dtype=int64)
 }}}

 I think this behavior is a bit weird, since depending on the value of the
 mask, a 0 or 1 dimensional array is returned. It is, however, doing what
 the bug asks for, so closing as fixed.

-- 
Ticket URL: <http://projects.scipy.org/numpy/ticket/721#comment:7>
NumPy <http://projects.scipy.org/numpy>
My example project


More information about the NumPy-Tickets mailing list