data type and logarithm

Robert Kern robert.kern at gmail.com
Thu Jun 16 17:21:56 EDT 2011


On 6/16/11 12:20 PM, Terry Reedy wrote:

> rho = mp.append(rho, float(r)) # same with entropy)
>
> does numpy really not let you write Python stype
>
> rho.append(float(r))
> ?

No. numpy arrays are not extensible in-place in general because we use view 
semantics for slices and similar operations like transpositions. We can't have 
the underlying memory change out from underneath us. This is one of the worst 
ways to accumulate values into a numpy array.

-- 
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 Python-list mailing list