[NumPy-Tickets] [NumPy] #1491: Bug when comparing str to object

NumPy Trac numpy-tickets@scipy....
Wed May 26 08:41:42 CDT 2010


#1491: Bug when comparing str to object
-----------------------+----------------------------------------------------
 Reporter:  kwgoodman  |       Owner:  somebody
     Type:  defect     |      Status:  new     
 Priority:  normal     |   Milestone:  2.0.0   
Component:  Other      |     Version:          
 Keywords:             |  
-----------------------+----------------------------------------------------
 Comparisons of dtpye=str on the left-hand side with dtype=object on the
 right-hand side fail:

 {{{
 >> a1 = np.array(['a', 'b'], dtype=object)
 >> a2 = np.array(['a', 'b'])
 >>
 >> a1 == a2
   array([ True,  True], dtype=bool)  # Looks good
 >> a2 == a1
   False  # Bug
 }}}
 Expected behavior:
 {{{
 >> a1 = np.array([1, 2], dtype=object)
 >> a2 = np.array([1, 2])
 >>
 >> a1 == a2
   array([ True,  True], dtype=bool)
 >> a2 == a1
   array([ True,  True], dtype=bool)
 }}}
 And similarly for the other comparison operators.

-- 
Ticket URL: <http://projects.scipy.org/numpy/ticket/1491>
NumPy <http://projects.scipy.org/numpy>
My example project


More information about the NumPy-Tickets mailing list