[Numpy-discussion] Ill-defined in-place operations (#1085)

Charles R Harris charlesr.harris@gmail....
Wed Apr 15 16:39:09 CDT 2009

On Wed, Apr 15, 2009 at 2:51 PM, Pauli Virtanen <pav@iki.fi> wrote:

> Wed, 15 Apr 2009 22:34:49 +0200, Matthieu Brucher wrote:
> > I think this is unavoidable. If we state clearly that every numpy
> > function assums non-pointer aliasing, then people have to care about
> > this themselves (like they would in Fortran, or in C++ for object-like
> > arrays).
> Nevertheless, this is an easy way to shoot yourself into foot. Also, (as
> indicated by the x.T example), it's doubtful anyone actually relies on
> the current behavior for N-D arrays, since it depends on order of data in
> memory, etc.
> It rather likely is possible to cheaply detect potentially troublesome
> cases and raise a warning. (The user can silence these, if the behavior
> is really relied on.) I don't know what is the performance impact of
> Python warnings, though.
> The alternative is to have really good documentation on views...

Asking the average user to understand memory issues is probably a bit much.
Better to raise a warning and let the sophisticated users override it if
they really need to. Checking if the same memory chunk is used should be
sufficient (I think that can be done).

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/numpy-discussion/attachments/20090415/bb6e7f22/attachment.html 

More information about the Numpy-discussion mailing list