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

Stéfan van der Walt stefan@sun.ac...
Fri Mar 6 19:18:06 CST 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