summaryrefslogtreecommitdiffstats
path: root/Objects/clinic
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2017-01-24 22:30:04 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2017-01-24 22:30:04 (GMT)
commit78d9e58f204ec4e90502b42c3e7d48dcd76ccb80 (patch)
tree2e00366df2118cdeef752f6301f80ff118f88833 /Objects/clinic
parent0105606f5531d9a22e672d3d2a72df2c5c447be8 (diff)
downloadcpython-78d9e58f204ec4e90502b42c3e7d48dcd76ccb80.zip
cpython-78d9e58f204ec4e90502b42c3e7d48dcd76ccb80.tar.gz
cpython-78d9e58f204ec4e90502b42c3e7d48dcd76ccb80.tar.bz2
Issues #29311, #29289: Fixed and improved docstrings for dict and OrderedDict
methods.
Diffstat (limited to 'Objects/clinic')
-rw-r--r--Objects/clinic/dictobject.c.h12
-rw-r--r--Objects/clinic/odictobject.c.h17
2 files changed, 15 insertions, 14 deletions
diff --git a/Objects/clinic/dictobject.c.h b/Objects/clinic/dictobject.c.h
index deec424..97918e8 100644
--- a/Objects/clinic/dictobject.c.h
+++ b/Objects/clinic/dictobject.c.h
@@ -6,7 +6,7 @@ PyDoc_STRVAR(dict_fromkeys__doc__,
"fromkeys($type, iterable, value=None, /)\n"
"--\n"
"\n"
-"Returns a new dict with keys from iterable and values equal to value.");
+"Create a new dictionary with keys from iterable and values set to value.");
#define DICT_FROMKEYS_METHODDEF \
{"fromkeys", (PyCFunction)dict_fromkeys, METH_FASTCALL|METH_CLASS, dict_fromkeys__doc__},
@@ -40,7 +40,7 @@ PyDoc_STRVAR(dict___contains____doc__,
"__contains__($self, key, /)\n"
"--\n"
"\n"
-"True if D has a key k, else False.");
+"True if the dictionary has a specified key, else False.");
#define DICT___CONTAINS___METHODDEF \
{"__contains__", (PyCFunction)dict___contains__, METH_O|METH_COEXIST, dict___contains____doc__},
@@ -49,7 +49,7 @@ PyDoc_STRVAR(dict_get__doc__,
"get($self, key, default=None, /)\n"
"--\n"
"\n"
-"D.get(key[, default]) -> D[key] if key in D, else default.");
+"Return the value for key if key is in the dictionary, else default.");
#define DICT_GET_METHODDEF \
{"get", (PyCFunction)dict_get, METH_FASTCALL, dict_get__doc__},
@@ -83,7 +83,9 @@ PyDoc_STRVAR(dict_setdefault__doc__,
"setdefault($self, key, default=None, /)\n"
"--\n"
"\n"
-"D.get(key,default), also set D[key]=default if key not in D.");
+"Insert key with a value of default if key is not in the dictionary.\n"
+"\n"
+"Return the value for key if key is in the dictionary, else default.");
#define DICT_SETDEFAULT_METHODDEF \
{"setdefault", (PyCFunction)dict_setdefault, METH_FASTCALL, dict_setdefault__doc__},
@@ -113,4 +115,4 @@ dict_setdefault(PyDictObject *self, PyObject **args, Py_ssize_t nargs, PyObject
exit:
return return_value;
}
-/*[clinic end generated code: output=6e9d917602373072 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=91aa6a9f3c402b1b input=a9049054013a1b77]*/
diff --git a/Objects/clinic/odictobject.c.h b/Objects/clinic/odictobject.c.h
index ee35af6..0e5092c 100644
--- a/Objects/clinic/odictobject.c.h
+++ b/Objects/clinic/odictobject.c.h
@@ -6,9 +6,7 @@ PyDoc_STRVAR(OrderedDict_fromkeys__doc__,
"fromkeys($type, /, iterable, value=None)\n"
"--\n"
"\n"
-"New ordered dictionary with keys from S.\n"
-"\n"
-"If not specified, the value defaults to None.");
+"Create a new ordered dictionary with keys from iterable and values set to value.");
#define ORDEREDDICT_FROMKEYS_METHODDEF \
{"fromkeys", (PyCFunction)OrderedDict_fromkeys, METH_FASTCALL|METH_CLASS, OrderedDict_fromkeys__doc__},
@@ -39,7 +37,9 @@ PyDoc_STRVAR(OrderedDict_setdefault__doc__,
"setdefault($self, /, key, default=None)\n"
"--\n"
"\n"
-"od.get(k,d), also set od[k]=d if k not in od.");
+"Insert key with a value of default if key is not in the dictionary.\n"
+"\n"
+"Return the value for key if key is in the dictionary, else default.");
#define ORDEREDDICT_SETDEFAULT_METHODDEF \
{"setdefault", (PyCFunction)OrderedDict_setdefault, METH_FASTCALL, OrderedDict_setdefault__doc__},
@@ -71,7 +71,7 @@ PyDoc_STRVAR(OrderedDict_popitem__doc__,
"popitem($self, /, last=True)\n"
"--\n"
"\n"
-"Return (k, v) and remove a (key, value) pair.\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.");
@@ -103,10 +103,9 @@ PyDoc_STRVAR(OrderedDict_move_to_end__doc__,
"move_to_end($self, /, key, last=True)\n"
"--\n"
"\n"
-"\"Move an existing element to the end (or beginning if last==False).\n"
+"Move an existing element to the end (or beginning if last is false).\n"
"\n"
-" Raises KeyError if the element does not exist.\n"
-" When last=True, acts like a fast version of self[key]=self.pop(key).");
+"Raise KeyError if the element does not exist.");
#define ORDEREDDICT_MOVE_TO_END_METHODDEF \
{"move_to_end", (PyCFunction)OrderedDict_move_to_end, METH_FASTCALL, OrderedDict_move_to_end__doc__},
@@ -132,4 +131,4 @@ OrderedDict_move_to_end(PyODictObject *self, PyObject **args, Py_ssize_t nargs,
exit:
return return_value;
}
-/*[clinic end generated code: output=84ef19e7b5db0086 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=a19a24ac37b42e5e input=a9049054013a1b77]*/