[NumPy-Tickets] [NumPy] #1695: numpy.r_[True, False] is not a boolean array

NumPy Trac numpy-tickets@scipy....
Tue Jan 4 03:07:46 CST 2011

#1695: numpy.r_[True, False] is not a boolean array
 Reporter:  O.C.        |       Owner:  somebody
     Type:  defect      |      Status:  new     
 Priority:  normal      |   Milestone:  2.0.0   
Component:  numpy.core  |     Version:  1.4.1   
 Keywords:              |  

Comment(by jpeel):

 The problem here was actually with the find_common_type function in
 core/numerictypes.py. This function goes through a typecodes string
 starting with 'b' which is supposed to be boolean
 ([http://docs.scipy.org/doc/numpy/reference/arrays.dtypes.html dtype]),
 but 'b' really means int8. From what I've figured out, '?' is really the
 typecode for boolean. Putting this at the front of the typecodes string
 fixes the problem.

 There isn't a problem with numpy._r([True]) or numpy._r([[True],[False]])
 because for the first case, find_common_type will just return the dtype of
 the item if there is only one item and for the second case,
 find_common_type isn't even used.

Ticket URL: <http://projects.scipy.org/numpy/ticket/1695#comment:2>
NumPy <http://projects.scipy.org/numpy>
My example project

More information about the NumPy-Tickets mailing list