@@ -1840,7 +1840,7 @@ are always available. They are listed here in alphabetical order.
18401840 Slice objects are now :term: `hashable ` (provided :attr: `~slice.start `,
18411841 :attr: `~slice.stop `, and :attr: `~slice.step ` are hashable).
18421842
1843- .. function :: sorted(iterable, /, *, key=None, reverse=False)
1843+ .. function :: sorted(iterable, /, *, key=None, keylist=None, reverse=False)
18441844
18451845 Return a new sorted list from the items in *iterable *.
18461846
@@ -1850,6 +1850,10 @@ are always available. They are listed here in alphabetical order.
18501850 key from each element in *iterable * (for example, ``key=str.lower ``). The
18511851 default value is ``None `` (compare the elements directly).
18521852
1853+ Alternative to key function is supplying a :class: `list ` object
1854+ to *keylist * argument, which will determine the sort order.
1855+ Provided :class: `list ` object will be modified in place.
1856+
18531857 *reverse * is a boolean value. If set to ``True ``, then the list elements are
18541858 sorted as if each comparison were reversed.
18551859
@@ -1872,6 +1876,11 @@ are always available. They are listed here in alphabetical order.
18721876
18731877 For sorting examples and a brief sorting tutorial, see :ref: `sortinghowto `.
18741878
1879+ .. versionchanged :: 3.15
1880+
1881+ Added *keylist * argument.
1882+
1883+
18751884.. decorator :: staticmethod
18761885
18771886 Transform a method into a static method.
0 commit comments