mirror of https://github.com/python/cpython
Fix link in programming FAQ.
The example actually uses the sort method of list object.
This commit is contained in:
parent
93818c752d
commit
5b6a14d1cb
|
@ -1312,7 +1312,7 @@ I want to do a complicated sort: can you do a Schwartzian Transform in Python?
|
|||
|
||||
The technique, attributed to Randal Schwartz of the Perl community, sorts the
|
||||
elements of a list by a metric which maps each element to its "sort value". In
|
||||
Python, use the ``key`` argument for the :func:`sort()` function::
|
||||
Python, use the ``key`` argument for the :meth:`list.sort` method::
|
||||
|
||||
Isorted = L[:]
|
||||
Isorted.sort(key=lambda s: int(s[10:15]))
|
||||
|
|
Loading…
Reference in New Issue