[NumPy-Tickets] [NumPy] #1718: "shape mismatch" error is not informative

NumPy Trac numpy-tickets@scipy....
Fri Jan 21 19:56:41 CST 2011


#1718: "shape mismatch" error is not informative
-------------------------+--------------------------------------------------
 Reporter:  andrea       |       Owner:  somebody
     Type:  enhancement  |      Status:  new     
 Priority:  normal       |   Milestone:  1.5.2   
Component:  numpy.core   |     Version:  1.5.0   
 Keywords:               |  
-------------------------+--------------------------------------------------
 The best thing about numpy is the support for slicing and indexing of
 tensors with arbitrary shapes. It's a pleasure to work with it.
 However, I often get errors like this:

      ValueError: shape mismatch: objects cannot be broadcast to a single
 shape

 This is not really informative, because it doesn't tell me what I did
 wrong.
 When you start playing with 5-6 dimensions, and start transposing
 dimensions, it's not that you can look at the code for an obvious mistake.
 Most of the time I have to put some temporary print statements just to get
 the size of the arrays involved.

 It would make life easier to have a more informative message such as:

      ValueError: shape mismatch: objects cannot be broadcast to a single
 shape. Required: (5,6,7,8)  Provided: (5,6,8,7).

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


More information about the NumPy-Tickets mailing list