Mercurial > cpython-lru_cache-weakref
diff Doc/lib/liboperator.tex @ 31212:5b035e6e44dc legacy-trunk
Guido grants a Christmas wish:
sorted() becomes a regular function instead of a classmethod.
| author | Raymond Hettinger <python@rcn.com> |
|---|---|
| date | Wed, 17 Dec 2003 20:50:46 +0000 |
| parents | 456e274f8602 |
| children | 67f2190e1f6d |
line wrap: on
line diff
--- a/Doc/lib/liboperator.tex Wed Dec 17 20:47:28 2003 +0000 +++ b/Doc/lib/liboperator.tex Wed Dec 17 20:50:46 2003 +0000 @@ -302,7 +302,7 @@ The \module{operator} module also defines tools for generalized attribute and item lookups. These are useful for making fast field extractors -as arguments for \function{map()}, \method{list.sort()}, +as arguments for \function{map()}, \function{sorted()}, \method{itertools.groupby()}, or other functions that expect a function argument. @@ -328,7 +328,7 @@ >>> getcount = itemgetter(1) >>> map(getcount, inventory) [3, 2, 5, 1] ->>> list.sorted(inventory, key=getcount) +>>> sorted(inventory, key=getcount) [('orange', 1), ('banana', 2), ('apple', 3), ('pear', 5)] \end{verbatim}
