Sorted List

Raaijmakers, Vincent (GE Infrastructure) Vincent.Raaijmakers at
Mon Jul 26 20:02:17 CEST 2004

Perhaps the online Python Cookbook is a good start.

-----Original Message-----
From: at [ at]On Behalf Of Dan
Sent: Monday, July 26, 2004 1:30 PM
To: python-list at
Subject: Sorted List

I like the sets type in python 2.4 but it has one major limitation, it is an unordered collection.


I needed a container more like a list, but sorted so that searches are fast and ensure elements are in a specifc order. This is very useful for 'fuzzy logic' type searching. I could not find any container in Python that fits this criteria, nor could I find one in the vault so I created SortedList.


It's really very simple, just a wrapper around a list that keeps it sorted and uses the bisect module to implement search member functions.


If there is a demand for it, I will implement it in C later, as that would be a good learning exercise for me.


I'm just finalizing the test code now ( which is sadly much longer than the code itself ).


What should I do with it when I'm done? Is there a place for Pythoniers to share code?







-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Python-list mailing list