2006/12/18, Robert Kern <[EMAIL PROTECTED]>:
zhang yunfeng wrote: > Hi, I'm newbie to Numpy. > > When reading tutorials at > http://www.scipy.org/Tentative_NumPy_Tutorial > <http://www.scipy.org/Tentative_NumPy_Tutorial>, I found a snippet about > addition of two arrays with different shape, Does it make sense? If > array shapes are not same, why it doesn't throw out an error? When two arrays of different shapes are operated against each other, numpy tries to "broadcast" them to a compatible shape according to certain rules. This is a fairly powerful concept, and it provides quite a lot of convenience. The following wiki page has an explanation of the broadcasting rules: http://www.scipy.org/EricsBroadcastingDoc
Yes, It seems powerful. But If one happened to add two incompatible array by mistake, Does the result make sense? May be the broadcast feature should be limited in a certain range not to mess normal operation. -- http://my.opera.com/zhangyunfeng
_______________________________________________ Numpy-discussion mailing list [email protected] http://projects.scipy.org/mailman/listinfo/numpy-discussion
