7 Mar
2009
7 Mar
'09
11:30 a.m.
2009/3/7 Charles R Harris
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?
The same as this:
In [1]: a = zeros(2)
In [2]: a[0] = '1'
In [3]: a Out[3]: array([ 1., 0.])
This difference is that, in your example, no information is lost. When assigning a complex value to a real array, you are probably doing something wrong. Cheers Stéfan