* Add clearer comment to initialization code.
* Add optional argument to popitem() -- modeled
  after Anthon van der Neut's C version.
* Fix method markup in docs.
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 @@
 
     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 @@
             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
 
diff --git a/Lib/test/test_collections.py b/Lib/test/test_collections.py
index f232df4..9e984ba 100644
--- a/Lib/test/test_collections.py
+++ b/Lib/test/test_collections.py
@@ -768,12 +768,19 @@
 class GeneralMappingTests(mapping_tests.BasicTestMappingProtocol):
     type2test = OrderedDict
 
+    def test_popitem(self):
+        d = self._empty_mapping()
+        self.assertRaises(KeyError, d.popitem)
+
 class MyOrderedDict(OrderedDict):
     pass
 
 class SubclassMappingTests(mapping_tests.BasicTestMappingProtocol):
     type2test = MyOrderedDict
 
+    def test_popitem(self):
+        d = self._empty_mapping()
+        self.assertRaises(KeyError, d.popitem)
 
 import doctest, collections