Java's TreeSet equivalent in Python?
- by viksit
I recently came across some Java code that simply put some strings into a Java TreeSet, implemented a distance based comparator for it, and then made its merry way into the sunset to compute a given score to solve the given problem.
My questions,
Is there an equivalent data structure available for Python?
The Java treeset looks basically to be an ordered dictionary that can use a comparator of some sort to achieve this ordering.
I see there's a PEP for Py3K for an OrderedDict, but I'm using 2.6.x. There are a bunch of ordered dict implementations out there - anyone in particular that can be recommended?
Thanks.