Matthew Koichi Grimes wrote: >Travis wrote: > > >>Short answer: No, they are not bugs. >> >>The rule is: >> >>In any mixed-type operation between two objects of the same >>fundamental "kind" (i.e. integer, float, complex) arrays always have >>precedence over "scalars" (where a 0-d array is considered a scalar >>in this context). >> >> >However, the fact that array-array operations behave differently >depending on whether one of the arrays is 0-dimensional still strikes me >as bad. Bad in the sense that it can lead to surprising and >hard-to-identify bugs in vectorized code designed to work with tensors >of various ranks, including 0. This equivalency between rank-0 arrays >and scalars seems like another instance of the rank-0 special-casing >that has been deemed bad in recarray and elsewhere. > > It all depends on your perspective. In this case, there are situations where one can argue either way. In this case, the simplicity of the definition of scalar is easier to remember: All things that become rank-0 arrays when array(...) is called are considered "scalars". Viewed from that perspective, your drawing of the line is less compelling.
Changing rules at this point has a built-in negative bias. Thus, the benefit of changing the rules must be substantial in order to get it to happen. Thanks for the feedback. -Travis _______________________________________________ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion