summaryrefslogtreecommitdiffstats
path: root/Lib/collections.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/collections.py')
-rw-r--r--Lib/collections.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/Lib/collections.py b/Lib/collections.py
index 1193ebf..8c0b426 100644
--- a/Lib/collections.py
+++ b/Lib/collections.py
@@ -30,7 +30,7 @@ class OrderedDict(dict, MutableMapping):
def clear(self):
self.__end = end = []
- end += [None, end, end] # null entry
+ end += [None, end, end] # sentinel node for doubly linked list
self.__map = {} # key --> [key, prev, next]
dict.clear(self)
@@ -61,10 +61,10 @@ class OrderedDict(dict, MutableMapping):
yield curr[0]
curr = curr[1]
- def popitem(self):
+ def popitem(self, last=True):
if not self:
raise KeyError('dictionary is empty')
- key = next(reversed(self))
+ key = next(reversed(self)) if last else next(iter(self))
value = self.pop(key)
return key, value