[Python-checkins] Backport docstring improvements to OrderedDict. (GH-3470)

Mariatta webhook-mailer at python.org
Sun Sep 10 21:11:20 EDT 2017


https://github.com/python/cpython/commit/2a0f7c34c386dc80519da6c3fb150f081943f204
commit: 2a0f7c34c386dc80519da6c3fb150f081943f204
branch: 3.6
author: Henk-Jaap Wagenaar <wagenaarhenkjaap at gmail.com>
committer: Mariatta <Mariatta at users.noreply.github.com>
date: 2017-09-10T18:11:18-07:00
summary:

Backport docstring improvements to OrderedDict. (GH-3470)

files:
M Lib/collections/__init__.py
M Objects/odictobject.c

diff --git a/Lib/collections/__init__.py b/Lib/collections/__init__.py
index 1d6822a3a0b..26aeac180c7 100644
--- a/Lib/collections/__init__.py
+++ b/Lib/collections/__init__.py
@@ -155,9 +155,9 @@ def clear(self):
         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')
diff --git a/Objects/odictobject.c b/Objects/odictobject.c
index 9e891152aff..65f90e83434 100644
--- a/Objects/odictobject.c
+++ b/Objects/odictobject.c
@@ -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)



More information about the Python-checkins mailing list