]> granicus.if.org Git - python/commitdiff
Backport docstring improvements to OrderedDict. (GH-3470)
authorHenk-Jaap Wagenaar <wagenaarhenkjaap@gmail.com>
Mon, 11 Sep 2017 01:11:18 +0000 (02:11 +0100)
committerMariatta <Mariatta@users.noreply.github.com>
Mon, 11 Sep 2017 01:11:18 +0000 (18:11 -0700)
Lib/collections/__init__.py
Objects/odictobject.c

index 1d6822a3a0b5e5e1ae591c45214dd6d57b488e00..26aeac180c7151369e377ea6729966db3b32e9b8 100644 (file)
@@ -155,9 +155,9 @@ class OrderedDict(dict):
         dict.clear(self)
 
     def popitem(self, last=True):
-        '''od.popitem() -> (k, v), return and remove a (key, value) pair.
-        Pairs are returned in LIFO order if last is true or FIFO order if false.
+        '''Remove and return a (key, value) pair from the dictionary.
 
+        Pairs are returned in LIFO order if last is true or FIFO order if false.
         '''
         if not self:
             raise KeyError('dictionary is empty')
index 9e891152affbdc371dca646859d7b841bfb3e151..65f90e83434edde74b23c792c2af79069063596b 100644 (file)
@@ -1154,10 +1154,12 @@ _odict_popkey(PyObject *od, PyObject *key, PyObject *failobj)
 /* popitem() */
 
 PyDoc_STRVAR(odict_popitem__doc__,
-"od.popitem() -> (k, v), return and remove a (key, value) pair.\n\
-        Pairs are returned in LIFO order if last is true or FIFO order if false.\n\
-\n\
-        ");
+"popitem($self, /, last=True)\n"
+"--\n"
+"\n"
+"Remove and return a (key, value) pair from the dictionary.\n"
+"\n"
+"Pairs are returned in LIFO order if last is true or FIFO order if false.");
 
 static PyObject *
 odict_popitem(PyObject *od, PyObject *args, PyObject *kwargs)