[Numpy-discussion] inconsistent dtype promotion in dimensionless arrays

Travis Oliphant oliphant@ee.byu....
Thu Apr 5 17:11:06 CDT 2007


Matthew Koichi Grimes wrote:

>I've noticed two dtype promotion behaviors that are surprising to me. 
>I'm hoping to get people's input as to whether I should file bug tickets 
>on them.
>  
>

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).

It's a rule whose reason has a long history.


-Travis



More information about the Numpy-discussion mailing list