diff options
author | Mitar <mitar.github@tnode.com> | 2012-10-15 04:16:46 -0700 |
---|---|---|
committer | Mitar <mitar.github@tnode.com> | 2012-10-15 04:16:46 -0700 |
commit | c3fabb282d429de931ef10c91cee55700578eb86 (patch) | |
tree | 6c13bec5b267372ab2b98a8d8f20c84829f19e0c /django/utils/datastructures.py | |
parent | 58365401c92d2377c93def71d33165a77f36157b (diff) | |
download | django-c3fabb282d429de931ef10c91cee55700578eb86.tar.gz |
Allow reversed iteration over SortedDict.
Iterators cannot be reversed easily without this method.
Diffstat (limited to 'django/utils/datastructures.py')
-rw-r--r-- | django/utils/datastructures.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/django/utils/datastructures.py b/django/utils/datastructures.py index ad17573104..d94a05dfb4 100644 --- a/django/utils/datastructures.py +++ b/django/utils/datastructures.py @@ -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: |