Commit b606b3d0 authored by Raymond Hettinger's avatar Raymond Hettinger

Guido grants a Christmas wish:

  sorted() becomes a regular function instead of a classmethod.
parent e708fbd2
...@@ -302,7 +302,7 @@ Example: Build a dictionary that maps the ordinals from \code{0} to ...@@ -302,7 +302,7 @@ Example: Build a dictionary that maps the ordinals from \code{0} to
The \module{operator} module also defines tools for generalized attribute The \module{operator} module also defines tools for generalized attribute
and item lookups. These are useful for making fast field extractors 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 \method{itertools.groupby()}, or other functions that expect a
function argument. function argument.
...@@ -328,7 +328,7 @@ Examples: ...@@ -328,7 +328,7 @@ Examples:
>>> getcount = itemgetter(1) >>> getcount = itemgetter(1)
>>> map(getcount, inventory) >>> map(getcount, inventory)
[3, 2, 5, 1] [3, 2, 5, 1]
>>> list.sorted(inventory, key=getcount) >>> sorted(inventory, key=getcount)
[('orange', 1), ('banana', 2), ('apple', 3), ('pear', 5)] [('orange', 1), ('banana', 2), ('apple', 3), ('pear', 5)]
\end{verbatim} \end{verbatim}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment