Skip to content

Commit

Permalink
Backport docstring improvements to OrderedDict. (GH-3470)
Browse files Browse the repository at this point in the history
  • Loading branch information
cryvate authored and Mariatta committed Sep 11, 2017
1 parent d6c397b commit 2a0f7c3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
4 changes: 2 additions & 2 deletions Lib/collections/__init__.py
Expand Up @@ -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')
Expand Down
10 changes: 6 additions & 4 deletions Objects/odictobject.c
Expand Up @@ -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)
Expand Down

0 comments on commit 2a0f7c3

Please sign in to comment.