[Python-checkins] r84242 - python/branches/py3k/Doc/library/operator.rst
benjamin.peterson
python-checkins at python.org
Sat Aug 21 22:01:28 CEST 2010
Author: benjamin.peterson
Date: Sat Aug 21 22:01:28 2010
New Revision: 84242
Log:
indent properly
Modified:
python/branches/py3k/Doc/library/operator.rst
Modified: python/branches/py3k/Doc/library/operator.rst
==============================================================================
--- python/branches/py3k/Doc/library/operator.rst (original)
+++ python/branches/py3k/Doc/library/operator.rst Sat Aug 21 22:01:28 2010
@@ -344,15 +344,15 @@
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
More information about the Python-checkins
mailing list