[Numpy-discussion] Strange behavior of operator *=

Nathaniel Smith njs at pobox.com
Tue Apr 5 10:37:56 EDT 2011


On Tue, Apr 5, 2011 at 6:39 AM, Alan G Isaac <alan.isaac at gmail.com> wrote:
> On 4/5/2011 9:26 AM, François Steinmetz wrote:
>> It does not change the dtype, 'int' is just interpreted as 'int64' :
>
> So the meaning of 'int' is system specific?
>
>     >>> import numpy as np; a=np.eye(2,dtype='int'); a.dtype
>     dtype('int32')

Yes, this is a fact about Python 'int', not a fact about numpy -- a
Python 'int' is defined to hold a C 'long', which will be either 32 or
64 bits depending on platform.

# 32-bit Linux:
$ python -c 'import sys; print sys.maxint'
2147483647

# 64-bit Linux:
$ python -c 'import sys; print sys.maxint'
9223372036854775807

-- Nathaniel



More information about the NumPy-Discussion mailing list