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:
parent
58365401c9
commit
c3fabb282d
@ -160,6 +160,9 @@ class SortedDict(dict):
|
|||||||
def __iter__(self):
|
def __iter__(self):
|
||||||
return iter(self.keyOrder)
|
return iter(self.keyOrder)
|
||||||
|
|
||||||
|
def __reversed__(self):
|
||||||
|
return reversed(self.keyOrder)
|
||||||
|
|
||||||
def pop(self, k, *args):
|
def pop(self, k, *args):
|
||||||
result = super(SortedDict, self).pop(k, *args)
|
result = super(SortedDict, self).pop(k, *args)
|
||||||
try:
|
try:
|
||||||
|
Loading…
Reference in New Issue
Block a user