data structures module

James Henderson james at logicalprogression.net
Fri Jan 16 13:23:34 EST 2004


On Friday 16 January 2004 7:06 am, MetalOne wrote:
> Today, I wanted a priority queue.
> I notice that Python does not have any sorted lists.
> I know that I can call list.sort(), but that seems rather inefficient
> to call every time an element is added.

You've already had several good suggestions.  I'll just add:

http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/87369

In the paper version of the Python Cookbook Tim says he has a special fondness 
for it, so it must be good!

> I am wondering why there is not a module or modules containing many
> common data structures.  Has such a thing been decided against?  Is it
> that just nobody has done it?  Has nobody else suggested the need for
> it?

The python-dev list has been discussing the introduction of a data structures 
package.  Looking at the thread called "collections module" might give you an 
insight to the thought processes involved.

James
-- 
James Henderson, Logical Progression Ltd.
http://www.logicalprogression.net/





More information about the Python-list mailing list