[Numpy-discussion] Assigning complex values to a real array

Stéfan van der Walt stefan at sun.ac.za
Fri Mar 6 20:18:06 EST 2009


Hi all,

The following code succeeds, while I thought it should fail:

a = np.zeros(6) # real
b= np.arange(6)*(2+3j) # complex
a[1] = b[1] # shouldn't this break?

What is the rationale behind this behaviour?

Cheers
Stéfan



More information about the NumPy-Discussion mailing list