[Numpy-discussion] deleting value from array
Wed Aug 15 08:30:53 CDT 2007
On Wed, Aug 15, 2007 at 03:11:59AM -0700, mark wrote:
> Yeah, I can see the copying is essential.
> I just think the syntax
> a = delete(a,1)
> confusing, as I would expect the deleted value back, rather than the
> updated array.
> As in the 'pop' function for lists.
> No 'pop' in numpy? (I presume this may have been debated extensively
> in the past).
> I find the syntax
> a.delete(1) more logical.
It is often considered in OO language that foo.method() modifies the foo
object, while function(foo) returns a new object, not modifying foo. This
is not always true in Python. Sometimes (eg strings) this is not true
because the object is immutable, sometimes there isn't this good reason.
I would be happy if we sticked to this convention. I find it makes the
language easier to guess.
More information about the Numpy-discussion