]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[doc] Remove duplicated operator.itemgetter example (GH-24178)
authorAndre Delfino <adelfino@gmail.com>
Tue, 27 Apr 2021 04:15:31 +0000 (01:15 -0300)
committerGitHub <noreply@github.com>
Tue, 27 Apr 2021 04:15:31 +0000 (21:15 -0700)
* Remove duplicated itemgetter example
* Add spaces

Doc/library/operator.rst

index 36c53556c2685e0112af1979046e4f2809922202..0cdba68f3770edfe9c536021efc1645ecba0eb36 100644 (file)
@@ -319,15 +319,12 @@ expect a function argument.
    method.  Dictionaries accept any hashable value.  Lists, tuples, and
    strings accept an index or a slice:
 
-      >>> itemgetter('name')({'name': 'tu', 'age': 18})
-      'tu'
       >>> itemgetter(1)('ABCDEFG')
       'B'
-      >>> itemgetter(1,3,5)('ABCDEFG')
+      >>> itemgetter(1, 3, 5)('ABCDEFG')
       ('B', 'D', 'F')
-      >>> itemgetter(slice(2,None))('ABCDEFG')
+      >>> itemgetter(slice(2, None))('ABCDEFG')
       'CDEFG'
-
       >>> soldier = dict(rank='captain', name='dotterbart')
       >>> itemgetter('rank')(soldier)
       'captain'