summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2021-04-27 04:16:33 (GMT)
committerGitHub <noreply@github.com>2021-04-27 04:16:33 (GMT)
commit1d7a53759ff41162aded89e8fd4e1867d8ba506b (patch)
treec862b0588b0c3feb1d45c11b5365153aedcd1fd6
parenta808aaba0537531395ed6162414c2d055d24f13b (diff)
downloadcpython-1d7a53759ff41162aded89e8fd4e1867d8ba506b.zip
cpython-1d7a53759ff41162aded89e8fd4e1867d8ba506b.tar.gz
cpython-1d7a53759ff41162aded89e8fd4e1867d8ba506b.tar.bz2
[doc] Remove duplicated operator.itemgetter example (GH-24178) (#25647)
* Remove duplicated itemgetter example * Add spaces (cherry picked from commit 743e2bae10d2010fd1e29b772c9da64efc7c9c47) Co-authored-by: Andre Delfino <adelfino@gmail.com>
-rw-r--r--Doc/library/operator.rst7
1 files changed, 2 insertions, 5 deletions
diff --git a/Doc/library/operator.rst b/Doc/library/operator.rst
index fa02bde..f2fb084 100644
--- a/Doc/library/operator.rst
+++ b/Doc/library/operator.rst
@@ -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'