[Numpy-discussion] proposal on ufunc shift operators.

Charles R Harris charlesr.harris@gmail....
Wed May 28 13:01:16 CDT 2008

Hi All,

Currently we have:

In [2]: ones(1,dtype=int8) << ones(1,dtype=uint8)
Out[2]: array([2], dtype=int16)

In [4]: ones(1,dtype=int64) << ones(1,dtype=uint64)
Out[4]: array([2], dtype=object)

Note the increased size in the first case and the return of a Python long
integer object in the second. I propose that these operators should preserve
the type of the first argument, although this is not easy to do with the
current ufunc setup. It is impossible to use a type of sufficient size for
all shift values and preserving the type of the first argument is what I
think most folks would expect.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/numpy-discussion/attachments/20080528/6502aabe/attachment.html 

More information about the Numpy-discussion mailing list