Skip to content

Commit 2a0f7c3

Browse files
cryvateMariatta
authored andcommitted
Backport docstring improvements to OrderedDict. (GH-3470)
1 parent d6c397b commit 2a0f7c3

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

Lib/collections/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,9 +155,9 @@ def clear(self):
155155
dict.clear(self)
156156

157157
def popitem(self, last=True):
158-
'''od.popitem() -> (k, v), return and remove a (key, value) pair.
159-
Pairs are returned in LIFO order if last is true or FIFO order if false.
158+
'''Remove and return a (key, value) pair from the dictionary.
160159
160+
Pairs are returned in LIFO order if last is true or FIFO order if false.
161161
'''
162162
if not self:
163163
raise KeyError('dictionary is empty')

Objects/odictobject.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1154,10 +1154,12 @@ _odict_popkey(PyObject *od, PyObject *key, PyObject *failobj)
11541154
/* popitem() */
11551155

11561156
PyDoc_STRVAR(odict_popitem__doc__,
1157-
"od.popitem() -> (k, v), return and remove a (key, value) pair.\n\
1158-
Pairs are returned in LIFO order if last is true or FIFO order if false.\n\
1159-
\n\
1160-
");
1157+
"popitem($self, /, last=True)\n"
1158+
"--\n"
1159+
"\n"
1160+
"Remove and return a (key, value) pair from the dictionary.\n"
1161+
"\n"
1162+
"Pairs are returned in LIFO order if last is true or FIFO order if false.");
11611163

11621164
static PyObject *
11631165
odict_popitem(PyObject *od, PyObject *args, PyObject *kwargs)

0 commit comments

Comments
 (0)