Skip to content
Browse files

Allow reversed iteration over SortedDict.

Iterators cannot be reversed easily without this method.
  • Loading branch information...
1 parent 5836540 commit c3fabb282d429de931ef10c91cee55700578eb86 @mitar mitar committed
Showing with 3 additions and 0 deletions.
  1. +3 −0 django/utils/
3 django/utils/
@@ -160,6 +160,9 @@ def __delitem__(self, key):
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)

0 comments on commit c3fabb2

Please sign in to comment.
Something went wrong with that request. Please try again.