[Numpy-discussion] array not appending

Robert Kern robert.kern at gmail.com
Thu Dec 18 15:50:00 EST 2008


On Thu, Dec 18, 2008 at 07:58, David Cournapeau
<david at ar.media.kyoto-u.ac.jp> wrote:

> What would be the need for a 0 item array ? If the point is to append
> some data without knowing in advance the size, a list is most likely
> more adapted to the task. An array which cannot be indexed does not
> sound that useful, but I may just lack some imagination :)

It's an edge case (literally) that can pop up when you are doing
slicing on larger arrays. 0-item arrays do fit in numpy's memory
model, so specifically disallowing them would mean gratuitously
requiring try: excepts: in code that would otherwise be generic.

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