]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[doc] Remove duplicated operator.itemgetter example (GH-24178) (#25647)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Tue, 27 Apr 2021 04:16:33 +0000 (21:16 -0700)
committerGitHub <noreply@github.com>
Tue, 27 Apr 2021 04:16:33 +0000 (21:16 -0700)
* Remove duplicated itemgetter example
* Add spaces
(cherry picked from commit 743e2bae10d2010fd1e29b772c9da64efc7c9c47)

Co-authored-by: Andre Delfino <adelfino@gmail.com>
Doc/library/operator.rst

index fa02bde84650e1e0cd1145ca6c997069f85ffb82..f2fb084ac17202a8960048a6fd5bcc0662758dea 100644 (file)
@@ -315,15 +315,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'