On Tue, Apr 5, 2011 at 8:44 AM, Alan G Isaac wrote:
> On 4/5/2011 10:37 AM, Nathaniel Smith wrote:
> > 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.
>
>
> So what is
On 4/5/2011 10:37 AM, Nathaniel Smith wrote:
> 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.
So what is the rule for Python 3, where iiuc it can no longer be "a fact abo
On Tue, Apr 5, 2011 at 6:39 AM, Alan G Isaac 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(
On 5. apr. 2011, at 15.39, Alan G Isaac 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('int
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')
Alan Isaac
___
2011/4/5 Alan G Isaac :
> On 4/5/2011 5:49 AM, François Steinmetz wrote:
>> >>> a = eye(2, dtype='int')
>> >>> a *= 1.0
>> >>> a ; a.dtype
>> array([[1, 0],
>> [0, 1]])
>> dtype('int64')
>
> This in-place (!) multiplication should not change
> the dtype of a. I suspect you did not exact
On 4/5/2011 5:49 AM, François Steinmetz wrote:
> >>> a = eye(2, dtype='int')
> >>> a *= 1.0
> >>> a ; a.dtype
> array([[1, 0],
> [0, 1]])
> dtype('int64')
This in-place (!) multiplication should not change
the dtype of a. I suspect you did not exactly cut
and paste...
Alan Isaac
___
Ok, thanks for the clarification !
François
On Tue, Apr 5, 2011 at 11:55, Matthieu Brucher
wrote:
> Indeed, it is not. In the first case, you keep your original object and
> each (integer) element is multiplied by 1.0. In the second example, you are
> creating a temporary object a*x, and as x is
Indeed, it is not. In the first case, you keep your original object and each
(integer) element is multiplied by 1.0. In the second example, you are
creating a temporary object a*x, and as x is a float and a an array of
integers, the result will be an array of floats, which will be assigned to
a.
M
Hi all,
I have encountered the following strangeness :
>>> from numpy import *
>>> __version__
'1.5.1'
>>> a = eye(2, dtype='int')
>>> a *= 1.0
>>> a ; a.dtype
array([[1, 0],
[0, 1]])
dtype('int64')
>>> a = a * 1.0
>>> a ; a.dtype
array([[ 1., 0.],
[ 0., 1.]])
dtype('float64')
So,
10 matches
Mail list logo