Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Allow reversed iteration over SortedDict.

Iterators cannot be reversed easily without this method.
  • Loading branch information...
commit c3fabb282d429de931ef10c91cee55700578eb86 1 parent 5836540
@mitar mitar authored
Showing with 3 additions and 0 deletions.
  1. +3 −0  django/utils/datastructures.py
View
3  django/utils/datastructures.py
@@ -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)
try:
Please sign in to comment.
Something went wrong with that request. Please try again.