Backport docstring improvements to OrderedDict. (GH-3470)

This commit is contained in:
Henk-Jaap Wagenaar 2017-09-11 02:11:18 +01:00 committed by Mariatta
parent d6c397bf77
commit 2a0f7c34c3
2 changed files with 8 additions and 6 deletions

View file

@ -155,9 +155,9 @@ class OrderedDict(dict):
dict.clear(self) dict.clear(self)
def popitem(self, last=True): def popitem(self, last=True):
'''od.popitem() -> (k, v), return and remove a (key, value) pair. '''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.
Pairs are returned in LIFO order if last is true or FIFO order if false.
''' '''
if not self: if not self:
raise KeyError('dictionary is empty') raise KeyError('dictionary is empty')

View file

@ -1154,10 +1154,12 @@ _odict_popkey(PyObject *od, PyObject *key, PyObject *failobj)
/* popitem() */ /* popitem() */
PyDoc_STRVAR(odict_popitem__doc__, PyDoc_STRVAR(odict_popitem__doc__,
"od.popitem() -> (k, v), return and remove a (key, value) pair.\n\ "popitem($self, /, last=True)\n"
Pairs are returned in LIFO order if last is true or FIFO order if false.\n\ "--\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 * static PyObject *
odict_popitem(PyObject *od, PyObject *args, PyObject *kwargs) odict_popitem(PyObject *od, PyObject *args, PyObject *kwargs)