changeset: 76631:295fec2cd5ed branch: 3.2 parent: 76627:23d5b457dc71 user: Raymond Hettinger date: Sun Apr 29 09:32:30 2012 -0700 files: Doc/howto/sorting.rst description: Issue 14688: Fix typo diff -r 23d5b457dc71 -r 295fec2cd5ed Doc/howto/sorting.rst --- a/Doc/howto/sorting.rst Sun Apr 29 13:35:55 2012 +0300 +++ b/Doc/howto/sorting.rst Sun Apr 29 09:32:30 2012 -0700 @@ -42,7 +42,7 @@ Key Functions ============= -Both :meth:`list.sort` and :func:`sorted` have *key* parameter to specify a +Both :meth:`list.sort` and :func:`sorted` have a *key* parameter to specify a function to be called on each list element prior to making comparisons. For example, here's a case-insensitive string comparison: @@ -89,7 +89,7 @@ The key-function patterns shown above are very common, so Python provides convenience functions to make accessor functions easier and faster. The :mod:`operator` module has :func:`~operator.itemgetter`, -:func:`~operator.attrgetter`, and an :func:`~operator.methodcaller` function. +:func:`~operator.attrgetter`, and a :func:`~operator.methodcaller` function. Using those functions, the above examples become simpler and faster: @@ -114,7 +114,7 @@ ======================== Both :meth:`list.sort` and :func:`sorted` accept a *reverse* parameter with a -boolean value. This is using to flag descending sorts. For example, to get the +boolean value. This is used to flag descending sorts. For example, to get the student data in reverse *age* order: >>> sorted(student_tuples, key=itemgetter(2), reverse=True)

AltStyle によって変換されたページ (->オリジナル) /