[Numpy-discussion] Inplace index suprise

Robert Kern robert.kern@gmail....
Thu Mar 20 14:05:46 CDT 2008

On Thu, Mar 20, 2008 at 1:35 PM, Gael Varoquaux
<gael.varoquaux@normalesup.org> wrote:
> On Thu, Mar 20, 2008 at 06:17:44PM +0000, James Philbin wrote:
>  > Hi,
>  > >  This cannot work, because the inplace operation does not
>  > >  take place as a for loop.
>  > Well, this would be fine if I was assigning the values to tempories as
>  > you suggest. However, the operation should be performed inplace and
>  > this is what I don't understand - why is there no for loop? I think
>  > the semantics of these inplace indexed operations is intuitively quite
>  > clear and numpy doesn't follow this intuition. Would there be any
>  > interest in changing this behaviour in numpy?
>  I think this is technicaly impossible from the way numpy works. This
>  breaks the numpy model that every operation is global on the array.

More importantly, it is technically impossible because of the way that
*Python* works. See the thread "Histograms via indirect index arrays"
for a detailed explanation.


Robert Kern

"I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own mad attempt to interpret it as
though it had an underlying truth."
 -- Umberto Eco

More information about the Numpy-discussion mailing list