mirror of https://github.com/python/cpython.git
#1755097: document default values for [].sort() and sorted().
This commit is contained in:
parent
437e15d42b
commit
a8cbad3b83
|
@ -1038,10 +1038,11 @@ available. They are listed here in alphabetical order.
|
||||||
*cmp* specifies a custom comparison function of two arguments (iterable
|
*cmp* specifies a custom comparison function of two arguments (iterable
|
||||||
elements) which should return a negative, zero or positive number depending on
|
elements) which should return a negative, zero or positive number depending on
|
||||||
whether the first argument is considered smaller than, equal to, or larger than
|
whether the first argument is considered smaller than, equal to, or larger than
|
||||||
the second argument: ``cmp=lambda x,y: cmp(x.lower(), y.lower())``
|
the second argument: ``cmp=lambda x,y: cmp(x.lower(), y.lower())``. The default
|
||||||
|
value is ``None``.
|
||||||
|
|
||||||
*key* specifies a function of one argument that is used to extract a comparison
|
*key* specifies a function of one argument that is used to extract a comparison
|
||||||
key from each list element: ``key=str.lower``
|
key from each list element: ``key=str.lower``. The default value is ``None``.
|
||||||
|
|
||||||
*reverse* is a boolean value. If set to ``True``, then the list elements are
|
*reverse* is a boolean value. If set to ``True``, then the list elements are
|
||||||
sorted as if each comparison were reversed.
|
sorted as if each comparison were reversed.
|
||||||
|
|
|
@ -1408,10 +1408,11 @@ Notes:
|
||||||
*cmp* specifies a custom comparison function of two arguments (list items) which
|
*cmp* specifies a custom comparison function of two arguments (list items) which
|
||||||
should return a negative, zero or positive number depending on whether the first
|
should return a negative, zero or positive number depending on whether the first
|
||||||
argument is considered smaller than, equal to, or larger than the second
|
argument is considered smaller than, equal to, or larger than the second
|
||||||
argument: ``cmp=lambda x,y: cmp(x.lower(), y.lower())``
|
argument: ``cmp=lambda x,y: cmp(x.lower(), y.lower())``. The default value
|
||||||
|
is ``None``.
|
||||||
|
|
||||||
*key* specifies a function of one argument that is used to extract a comparison
|
*key* specifies a function of one argument that is used to extract a comparison
|
||||||
key from each list element: ``key=str.lower``
|
key from each list element: ``key=str.lower``. The default value is ``None``.
|
||||||
|
|
||||||
*reverse* is a boolean value. If set to ``True``, then the list elements are
|
*reverse* is a boolean value. If set to ``True``, then the list elements are
|
||||||
sorted as if each comparison were reversed.
|
sorted as if each comparison were reversed.
|
||||||
|
|
Loading…
Reference in New Issue