Sorted List

Dan dan at eloff.info
Mon Jul 26 13:29:34 EDT 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
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?

 

-Dan

 

 

 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20040726/d25cb9a9/attachment.html>


More information about the Python-list mailing list