[Numpy-discussion] array allocation using tuples gives views of same array

Warren Focke focke@slac.stanford....
Thu Nov 15 09:29:12 CST 2007



On Thu, 15 Nov 2007, George Nurser wrote:

> It looks to me like
> a,b = (zeros((2,)),)*2
> is equivalent to
> x= zeros((2,))
> a,b=(x,)*2

Correct.

> If this is indeed a feature rather than a bug, is there an alternative
> compact way to allocate many arrays?

a, b = [zeros((2,)) for x in range(2)]



More information about the Numpy-discussion mailing list