mirror of
https://github.com/django/django.git
synced 2025-09-27 20:49:21 +00:00
Allow reversed iteration over SortedDict.
Iterators cannot be reversed easily without this method.
This commit is contained in:
parent
58365401c9
commit
c3fabb282d
1 changed files with 3 additions and 0 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue