[Numpy-discussion] Binary ufuncs: minimum

Travis E. Oliphant oliphant@enthought....
Tue May 27 15:10:37 CDT 2008


Stéfan van der Walt wrote:
> Did this change recently?
>
> In [33]: np.__version__
> Out[33]: '1.1.0.dev5211'
>
> In [34]: np.minimum(np.uint8(164), np.uint64(12807)).dtype
> Out[34]: dtype('uint64')
>
> But yes, that looks like it should return a uint8.
>   
This discussion is really moot unless a proposal for how to handle 
different casting rules for different ufuncs is proposed.   Right now, 
the type-promotion rules are generic and do not depend on the ufunc only 
on coercion rules for the mixed types.

One problem with a casting-rules-per-ufunc approach is that it makes it 
harder to add new types and have them fit in to the casting structure 
(which is currently possible now).   Some mechanism for allowing the 
types to plug-in to the per-ufunc rules would be needed.

These are not impossible things, just a bit of work and not on my 
personal priority list.

-Travis



More information about the Numpy-discussion mailing list