np.zeros of structured array of array of objects

Hi, looking at https://github.com/numpy/numpy/issues/4857 I noticed that np.zeros of a structured array of array of objects only initializes the first element of if the embedded array to zero and leaves the rest None: In [1]: a = numpy.zeros(10, dtype=[('multiple objects', object, 2)]); a Out[1]: array([([0, None],), ([0, None],), ([0, None],), ([0, None],), ([0, None],), ([0, None],), ([0, None],), ([0, None],), ([0, None],), ([0, None],)], dtype=[('multiple objects', 'O', (2,))]) Is this the intented behavior? I would have expected all fields to be set to an int-object 0. If not can we change it or is it too likely people rely on this behavior?

On Fri, Jul 11, 2014 at 8:39 AM, Julian Taylor <jtaylor.debian@googlemail.com> wrote:
Hi, looking at https://github.com/numpy/numpy/issues/4857 I noticed that np.zeros of a structured array of array of objects only initializes the first element of if the embedded array to zero and leaves the rest None:
In [1]: a = numpy.zeros(10, dtype=[('multiple objects', object, 2)]); a Out[1]: array([([0, None],), ([0, None],), ([0, None],), ([0, None],), ([0, None],), ([0, None],), ([0, None],), ([0, None],), ([0, None],), ([0, None],)], dtype=[('multiple objects', 'O', (2,))])
Is this the intented behavior? I would have expected all fields to be set to an int-object 0. If not can we change it or is it too likely people rely on this behavior?
Looks like a bug to me, and I can't off-hand think of any reason why anyone would be relying on this... I vote that unless someone speaks up we just fix it. If it really does break anything then we can always catch that in beta... -- Nathaniel J. Smith Postdoctoral researcher - Informatics - University of Edinburgh http://vorpus.org
participants (2)
-
Julian Taylor
-
Nathaniel Smith