Summer reading list

John J. Lee jjl at pobox.com
Tue Aug 12 20:56:03 EDT 2003


"Andrew Dalke" <adalke at mindspring.com> writes:

> Joe Cheng:
> > It might just be my Java background creeping in (I'm a Python newbie), but,
> > wouldn't it be better if this was OO?
> 
> Here's perhaps the definitive statement on the topic, from Tim Peters:
> http://aspn.activestate.com/ASPN/Mail/Message/python-dev/1620162
> 
> Summary: heapq is a concrete interface, not an abstract one.  It doesn't
> try to encompass the different ways to do heaps.  It's like bisect in that
> it works on an existing data type.

That URL comes up blank for me.  Found this, though:

http://www.python.org/dev/summary/2003-04-16_2003-04-30.html

| The idea of turning the heapq module into a class came up, and later
| led to the idea of having a more proper FIFO (First In, First Out)
| data structure. Both ideas were shot down. The reason for this was
| that the stdlib does not need to try to grow every single possible
| data structure in programming. Guido's design philosophy is to have a
| few very powerful data structures that other ones can be built off
| of. This is why the bisect and heapq modules just work on standard
| lists instead of defining a new class. Queue is an exception, but it
| is designed to mediate messages between threads instead of being a
| general implementation of a queue.


John




More information about the Python-list mailing list