PEP Request: Advanced Data Structures

Terry Reedy tjreedy at udel.edu
Sat Jul 16 20:10:47 EDT 2016


On 7/16/2016 6:14 PM, shrey.desai at gmail.com wrote:
> I have found it slightly frustrating that Python does not have
> built-in support for advanced data structures (Linked Lists,

You and I have different ideas of 'advanced data structures' ;-).  To 
me, linked list are limited structures used in functional programming to 
make mutable structure from immutable-except-on-creation cells.  In any 
case, one can easily use tuples to create branching structures.  Tuples 
and lists containing tuples and lists are routine in python programming. 
Wrapping such usage in a LinkedList class is optional -- and unusual.

> Stacks/Queues,

Nearly two decades ago, I promoted the addition of the list.pop method 
as the inverse of list.append, in order to make lists easily usable as 
stacks.  This is routine in python code today.

collections.deque instances are advanced data structures that can be 
used as stacks, queues, or both, at either end.  The class has tests 
that I presume are rigorous.

> BST)

British Summer Time? (Suggestion from Google)

> Currently, we are required to write our own modules that represent
> these data structures and rigorously test/refactor them before we can
> actually use them.

If an instructor makes you wrap the structures that Python provides 
before you can use then, that is between you and the instructor, and not 
our doing.  The instructor could let you use Python as it is or hand you 
the wrapping he likes.

-- 
Terry Jan Reedy




More information about the Python-list mailing list