[Numpy-discussion] implicit coersion int8 -> int16 ?

Simon Burton simon at arrowtheory.com
Sat May 20 19:45:04 EDT 2006


On Sun, 21 May 2006 12:28:10 +0100
Simon Burton <simon at arrowtheory.com> wrote:

> 
> >>> a=numpy.array([1,2,3],numpy.Int8)
> >>> a
> array([1, 2, 3], dtype=int8)
> >>> a*2
> array([2, 4, 6], dtype=int16)
> >>> 
> 
> My little 2 lives happily as an int8, so why is the int8 array
> cast to an int16 ?

As a workaround, i found this:
>>> a*=2
>>> a
array([2, 4, 6], dtype=int8)

Simon.

-- 
Simon Burton, B.Sc.
Licensed PO Box 8066
ANU Canberra 2601
Australia
Ph. 61 02 6249 6940
http://arrowtheory.com 




More information about the NumPy-Discussion mailing list