Commit c3fabb28 authored by Mitar's avatar Mitar
Browse files

Allow reversed iteration over SortedDict.

Iterators cannot be reversed easily without this method.
parent 58365401
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -160,6 +160,9 @@ class SortedDict(dict):
    def __iter__(self):
        return iter(self.keyOrder)

    def __reversed__(self):
        return reversed(self.keyOrder)

    def pop(self, k, *args):
        result = super(SortedDict, self).pop(k, *args)
        try: