[Numpy-discussion] Resize Method for Numpy Array

Robert Kern robert.kern@gmail....
Thu Sep 24 17:36:54 CDT 2009


On Thu, Sep 24, 2009 at 17:32, Sturla Molden <sturla@molden.no> wrote:
> Robert Kern skrev:
>> While this description is basically true of numpy arrays, I would
>> caution you that every language has a different lexicon, and the same
>> word can mean very different things in each. For example, Python lists
>> are *not* linked lists; they are like C++'s std::vectors with a
>> preallocation strategy to make appending cheap on average.
>>
> In Java and .NET jargon, Python lists are array lists, not linked lists.
>
> It is sad there is no "cons" or "llist" built-in type, something like:
>
>   mycons = cons(car, cdr)
>   mylist = llist(iterable)
>
>
> Of course we can write [car, cdr] or (car, cdr) for making linked lists
> in pure Python (without having to define class types), but both have
> issues.The first is storage inefficient, the latter is not mutable.
>
> Yes I know Guido left out linked lists for a purpose, so there is
> probably no use complaining on the Python ideas of Python dev lists...

collections.deque() is a linked list of 64-item chunks.

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