[Numpy-discussion] performing operations in-place in numpy

Robert Kern robert.kern@gmail....
Thu Jul 9 10:34:00 CDT 2009


On Thu, Jul 9, 2009 at 10:30, Citi, Luca<lciti@essex.ac.uk> wrote:
> Hello Gaël,
>
> I think it might be an option.
>
> Also one could have an internal flag which says whether or not is safe
> to overwrite inputs with ref_count=1.
> Then import_array() sets this flag to "unsafe" (i.e. current behaviour).
> If the user of the numpy C-api is aware of how the new feature works,
> he/she can enable it by switching the flag to "safe" and act accordingly
> (increase refcounts before / decrease after) whenever he/she needs an array
> for later reuse.
> If possible, when imported from python (is there a way to know it? is
> import_array() called anyway?) the flag could be set to "safe".

I'm not sure how best to explain why, but suffice it to say that this
will not work.

-- 
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