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

Warren Focke focke at slac.stanford.edu
Thu Nov 15 10:29:12 EST 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


> 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