Sorted List

Dan dan at
Mon Jul 26 19:29:34 CEST 2004

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


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