PEP Request: Advanced Data Structures

cs at zip.com.au cs at zip.com.au
Sat Jul 16 20:54:26 EDT 2016


On 16Jul2016 19:49, Dennis Lee Bieber <wlfraed at ix.netcom.com> wrote:
>On Sat, 16 Jul 2016 15:33:12 -0700 (PDT), Shrey Desai
><shrey.desai at gmail.com> declaimed the following:
>>- Education: the Linked List is a core data structure that CS undergraduates 
>>(among others) use and study, so it is vital that they have hands on access 
>>to them. A list is basically a dynamic array; the only property it shares 
>>with a Linked List is that it's dynamic.
>
>	My CS courses required us to implement our own linked lists (in FORTRAN
>IV yet). Providing a built-in linked list just negates the educational
>aspect.

I was thinking this exact same thing.

>>- Development: the use of correct data structures is important when 
>>developing applications, especially for issues like scaling and efficiency. 
>>For instance, when working with polynomials, Linked Lists provide a great 
>>interface to access and edit them.
>
>	What does having links gain you that you don't get from a regular list
>with slicing?

Well, in a larger context you can keep a reference to an element deep in the 
list, and insert a new element in O(1) time at that point.

The usualy argument against providing linked lists and other basic graph 
related functions in the stdlib is that there are in practice many many 
decisions one can make about exactly what kind of implementation specifics one 
might like in such a thing, and what methods to present for use with the thing.

On the flip side, implementing a simple linked list in a specific context is 
pretty trivial as Chris has demonstrated. I do take the point that a 
preexisting (and hopefully debugged) class would obviate a testing burden for 
users. Provided the class provided enough. If it didn't the end user is back to 
replacing or extending it, and having to test anyway.

To the OP: have you looked in PyPI and found no graph classes?

Cheers,
Cameron Simpson <cs at zip.com.au>



More information about the Python-list mailing list