[Numpy-discussion] dtype promotion

Nicolas Rougier Nicolas.Rougier at inria.fr
Mon Mar 3 16:06:57 EST 2014


Hi all,

I'm using numpy 1.8.0 (osx 10.9, python 2.7.6) and I can't understand dtype promotion in the following case:

>>> Z = np.zeros((2,2),dtype=np.float32) + 1
>>> print Z.dtype
float32

>>> Z = np.zeros((2,2),dtype=np.float32) + (1,1)
>>> print Z.dtype
float64


Is this the expected behavior ?
What it the difference between the two lines ?



Nicolas


More information about the NumPy-Discussion mailing list