summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2010-08-21 20:01:28 (GMT)
committerBenjamin Peterson <benjamin@python.org>2010-08-21 20:01:28 (GMT)
commitffec810d886bb1e1f71e4d132b494143a091e663 (patch)
tree0ce72e2e487eca988ea24e206a73dfebf307206b /Doc
parentb46b9d59ef1e2433b00c6d3fee077e57644c84bb (diff)
downloadcpython-ffec810d886bb1e1f71e4d132b494143a091e663.zip
cpython-ffec810d886bb1e1f71e4d132b494143a091e663.tar.gz
cpython-ffec810d886bb1e1f71e4d132b494143a091e663.tar.bz2
indent properly
Diffstat (limited to 'Doc')
-rw-r--r--Doc/library/operator.rst18
1 files changed, 9 insertions, 9 deletions
diff --git a/Doc/library/operator.rst b/Doc/library/operator.rst
index e24c69f..54edf31 100644
--- a/Doc/library/operator.rst
+++ b/Doc/library/operator.rst
@@ -344,15 +344,15 @@ expect a function argument.
operand's :meth:`__getitem__` method. If multiple items are specified,
returns a tuple of lookup values. Equivalent to::
- def itemgetter(*items):
- if len(items) == 1:
- item = items[0]
- def g(obj):
- return obj[item]
- else:
- def g(obj):
- return tuple(obj[item] for item in items)
- return g
+ def itemgetter(*items):
+ if len(items) == 1:
+ item = items[0]
+ def g(obj):
+ return obj[item]
+ else:
+ def g(obj):
+ return tuple(obj[item] for item in items)
+ return g
The items can be any type accepted by the operand's :meth:`__getitem__`
method. Dictionaries accept any hashable value. Lists, tuples, and