[Numpy-discussion] bug in ndarray.resize?

Francesc Alted faltet@pytables....
Thu Mar 18 03:55:49 CDT 2010


A Wednesday 17 March 2010 22:56:20 Charles R Harris escrigué:
> On Wed, Mar 17, 2010 at 8:42 AM, Alan G Isaac <aisaac@american.edu> wrote:
> > On 3/17/2010 10:16 AM, josef.pktd@gmail.com wrote:
> > > numpy.resize(a, new_shape)
> > > Return a new array with the specified shape.
> > >
> > > If the new array is larger than the original array, then the new array
> > > is filled with repeated copied of a. Note that this behavior is
> > > different from a.resize(new_shape) which fills with zeros instead of
> > > repeated copies of a.
> >
> > Yes indeed.  Sorry, I must have scrolled the help without realizing it,
> > and this part was at the top.
> >
> > So my follow up: why is this desirable/necessary?  (I find it
> > surprising.)
> 
> IIRC, it behaved that way in Numeric.

This does not mean that this behaviour is desirable.  I find it inconsistent 
and misleading so +1 for fixing it.

-- 
Francesc Alted


More information about the NumPy-Discussion mailing list