Allow reversed iteration over SortedDict.
Iterators cannot be reversed easily without this method.
This commit is contained in:
parent
58365401c9
commit
c3fabb282d
|
@ -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:
|
||||
|
|
Loading…
Reference in New Issue