PEP Request: Advanced Data Structures

Rustom Mody rustompmody at gmail.com
Sun Jul 17 03:33:55 EDT 2016


On Sunday, July 17, 2016 at 3:45:04 AM UTC+5:30, Shrey Desai wrote:
> I have found it slightly frustrating that Python does not have built-in support for advanced data structures (Linked Lists, Stacks/Queues, BST) in its distribution. Many computer science students, developers, and software engineers rely on these data structures; having the data structures be a part of the distribution and be maintained by the Python community would be immensely useful. 
> 
> 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. This gets annoying because instead of spending time USING the "correct" version of the data structure, we have to spend time creating them in the first place.
> 
> Programming languages like Java have support for Linked Lists, for example, which makes it easy to just use it instead of trying to create it over again. As a computer science undergraduate student, I don't want to spend time writing the module but instead I want to work with it, play around with it, and do problems with it. 
> 
> I know Python currently has a Queue module, but this can definitely be expanded. There are other more advanced data structures out there, like AVL trees, splay trees, and tries, but I think that would be overkilll. Having these data structures above would be immensely useful.
> 
> I'm looking to create a PEP for this issue and some people that would be willing to 1) vouch for this idea and 2) co-author the draft. Eventually, we would be co-developers for the project as well.
> 
> Who's in?

Hi Shrey
Your wish and direction is commendable
And looks at an important question
Do consider however that the boot may well be on the other foot: viz.

So
“Python does not have advanced data structures… fir students/edu-purposes”
may suggest that python should change

Or that education should!

Some examples of the nature the the fast-shifting ground under our feet:
It was important for programmers to know and use registers/instruction-formats
etc very effectively at one time.  At some time it stopped being relevant.

Or card-punches, Or large central ACs, Or tape drives, Or interrupts.

Some of these have just died; some remain in specialized places; some are ubiquitous
but with enough strong abstractions that vanilla programmers dont ever think of
these nowadays

The same holds for broad areas
Cryptography is where CS started in WWII; vanished thereafter; reappeared in
specialized quarters of late
Numerical computing was the hi-cathedral for the next few decades
By the time I was a student in the 80s it was there but somehow felt old and past-tense.
I expect recently instituted courses dont have it; or have it specialized.

These shifts are elaborated somewhat more 
https://mail.python.org/pipermail/python-list/2016-June/710678.html
and sequel

Coming to data structures (and algorithms)
yes it (they) are important courses… and widely misunderstood

Here is Bob Harper *quoting a developer*
everyone knows that algorithms as we learned  them  at  school  are  irrelevant  to  practice."
https://www.cs.cmu.edu/~rwh/papers/secp/secp.pdf (pg 2)
[Harper is a senior respected faculty at Carnegie Mellon]

I think the same applies to data structures with redoubled force:
Most of what is called data structures — linked lists etc — should really be 
called *storage structures*

ie How to survive and do useful work when your system/software is highly crippling.

Greenspun's 10th law:
Any sufficiently complicated C program contains an ad hoc, informally-specified, bug-ridden, slow implementation of half of Lisp.

If you understand that python is in a sense closer to Lisp than to C,
maybe you see that there are broadly two choices

- Traditional CS-edu view... C, C++, Java, OO-gook, data-structures, algorithms
  etc where the basic philosophy is
  Crippling is a way of life; Be Brave! And hobble more vigorously!‘

- The alternative CS view as understood by Harper, MIT and other progressive
  places embracing the ‘functional’ style (stupid word if you ask me)
  The idea being to throw out 70-80 % of traditional CS from the curriculum
  and get students doing good stuff much faster by putting them on a *different*
  learning curve.

That this stuff is a bit bleeding edge can be seen in the fact that ACM curriculum
has started embracing “functional” only in 2013 — ie 50 years after Lisp:
http://blog.languager.org/2015/06/functional-programming-moving-target.html

Sorry for a ramble.
Summary: Yes the languages we use to teach need to be rethought
So does our teaching ;-)



More information about the Python-list mailing list