diff options
author | Tim Hoffmann <2836374+timhoffm@users.noreply.github.com> | 2019-06-01 04:10:02 (GMT) |
---|---|---|
committer | Raymond Hettinger <rhettinger@users.noreply.github.com> | 2019-06-01 04:10:02 (GMT) |
commit | 5c22476c01622f11b7745ee693f8b296a9d6a761 (patch) | |
tree | c541fc26a67bdd89fafa9dda524dda3ebdfdeec8 /Objects/listobject.c | |
parent | 396e0a8d9dc65453cb9d53500d0a620602656cfe (diff) | |
download | cpython-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.c | 12 |
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; |