[Numpy-discussion] hstack(arr_Int32, arr_float32) fails because of casting rules

Travis Oliphant oliphant.travis at ieee.org
Thu Aug 24 21:46:51 CDT 2006

Sebastian Haase wrote:
> On Thursday 24 August 2006 17:28, Travis Oliphant wrote:
> Are you saying the  ufunc-rules  would convert "int32-float32" to float64  and 
> hence make my code "just work" !?
Yes.  That's what I'm saying (but you would get float64 out --- but if 
you didn't want that then you would have to be specific).

> And why are there two sets of rules ?
Because there are two modules (multiarray and umath) where the 
functionality is implemented.

> Are the Numeric rules used at many places ?
Not that many.  I did abstract the notion to a C-API:  
PyArray_ConvertToCommonType and implemented the 
scalars-don't-cause-upcasting part of the ufunc rules in that code.   
But, I followed the old-style Numeric coercion rules for the rest of it 
(because I was adapting Numeric).

Right now, unless there are strong objections, I'm leaning to changing 
that so that the same coercion rules are used whenever a common type is 

It would not be that difficult of a change.


More information about the Numpy-discussion mailing list