[Numpy-discussion] behavior of 'insert' for inserting multiple values

mark markbak@gmail....
Tue May 27 03:15:23 CDT 2008


Hello list.

When I try to insert multiple values in one place, I want to do this:

>>> a = arange(5.)
>>> insert(a,3,[7,7])
array([ 0.,  1.,  2.,  7.,  3.,  4.])

But insert only inserts one of the 7's, while I want both values to be
inserted. Nor does numpy throw a warning (which I think would be
appropriate). The way that works correctly is

>>> insert(a,[3,3],[7,7])
array([ 0.,  1.,  2.,  7.,  7.,  3.,  4.])

Wouldn't it make sense if the first example works as well?

Mark


More information about the Numpy-discussion mailing list