1
0
mirror of https://github.com/django/django.git synced 2024-12-24 10:05:46 +00:00

Allow reversed iteration over SortedDict.

Iterators cannot be reversed easily without this method.
This commit is contained in:
Mitar 2012-10-15 04:16:46 -07:00
parent 58365401c9
commit c3fabb282d

View File

@ -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: