[Numpy-discussion] discussion about array.resize() -- compare to numarray

Sebastian Haase seb.haase at gmx.net
Mon Jan 8 13:15:11 EST 2007


On 1/8/07, Stefan van der Walt <stefan at sun.ac.za> wrote:
> On Fri, Jan 05, 2007 at 01:57:50PM -0800, Russell E Owen wrote:
> > I also checked the numpy 1.0.1 help and I confess I don't understand at
> > all what it claims to do if the new size is larger. It first says it
> > repeats a and then it says it zero-fills the output.
> >
> > >>> help(numpy.resize)
> > Help on function resize in module numpy.core.fromnumeric:
> >
> > resize(a, new_shape)
> >     resize(a,new_shape) returns a new array with the specified shape.
> >     The original array's total size can be any size. It
> >     fills the new array with repeated copies of a.
> >
> >     Note that a.resize(new_shape) will fill array with 0's
> >     beyond current definition of a.
>
> The docstring refers to the difference between
>
> N.resize(x,6)
>
> and
>
> x.resize(6)
>
Hi Stéfan,

Why is there a needed for this very confusing dualty !?
I would almost like to file a bug report on this !

(It definitily broke "backwards compatibility" for my code coming from
numarray )

-Sebastian



More information about the NumPy-Discussion mailing list