summaryrefslogtreecommitdiffstats
path: root/Objects/listobject.c
diff options
context:
space:
mode:
authorTim Hoffmann <2836374+timhoffm@users.noreply.github.com>2019-06-01 04:10:02 (GMT)
committerRaymond Hettinger <rhettinger@users.noreply.github.com>2019-06-01 04:10:02 (GMT)
commit5c22476c01622f11b7745ee693f8b296a9d6a761 (patch)
treec541fc26a67bdd89fafa9dda524dda3ebdfdeec8 /Objects/listobject.c
parent396e0a8d9dc65453cb9d53500d0a620602656cfe (diff)
downloadcpython-5c22476c01622f11b7745ee693f8b296a9d6a761.zip
cpython-5c22476c01622f11b7745ee693f8b296a9d6a761.tar.gz
cpython-5c22476c01622f11b7745ee693f8b296a9d6a761.tar.bz2
Improve docstring of list.sort (GH-8516)
Diffstat (limited to 'Objects/listobject.c')
-rw-r--r--Objects/listobject.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/Objects/listobject.c b/Objects/listobject.c
index 233f13d..f8bf45e 100644
--- a/Objects/listobject.c
+++ b/Objects/listobject.c
@@ -2197,12 +2197,20 @@ list.sort
key as keyfunc: object = None
reverse: bool(accept={int}) = False
-Stable sort *IN PLACE*.
+Sort the list in ascending order and return None.
+
+The sort is in-place (i.e. the list itself is modified) and stable (i.e. the
+order of two equal elements is maintained).
+
+If a key function is given, apply it once to each list item and sort them,
+ascending or descending, according to their function values.
+
+The reverse flag can be set to sort in descending order.
[clinic start generated code]*/
static PyObject *
list_sort_impl(PyListObject *self, PyObject *keyfunc, int reverse)
-/*[clinic end generated code: output=57b9f9c5e23fbe42 input=b0fcf743982c5b90]*/
+/*[clinic end generated code: output=57b9f9c5e23fbe42 input=cb56cd179a713060]*/
{
MergeState ms;
Py_ssize_t nremaining;