Re: [Numpy-discussion] np.array creation: unexpected behaviour

2014-01-24 Thread Stéfan van der Walt
On Fri, 24 Jan 2014 17:30:33 +0100, Emanuele Olivetti wrote: > I just came across this unexpected behaviour when creating > a np.array() from two other np.arrays of different shape. The tuple parsing for the construction of new numpy arrays is pretty tricky/hairy, and doesn't always do exactly wha

Re: [Numpy-discussion] np.array creation: unexpected behaviour

2014-01-24 Thread josef . pktd
On Fri, Jan 24, 2014 at 11:30 AM, Emanuele Olivetti wrote: > Hi, > > I just came across this unexpected behaviour when creating > a np.array() from two other np.arrays of different shape. > Have a look at this example: > > import numpy as np > a = np.zeros(3) > b = np.zeros((2,3)) > c = np.ze

[Numpy-discussion] np.array creation: unexpected behaviour

2014-01-24 Thread Emanuele Olivetti
Hi, I just came across this unexpected behaviour when creating a np.array() from two other np.arrays of different shape. Have a look at this example: import numpy as np a = np.zeros(3) b = np.zeros((2,3)) c = np.zeros((3,2)) ab = np.array([a, b]) print ab.shape, ab.dtype ac = np.array([a, c],