Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b46b9d5 commit ffec810Copy full SHA for ffec810
1 file changed
Doc/library/operator.rst
@@ -344,15 +344,15 @@ expect a function argument.
344
operand's :meth:`__getitem__` method. If multiple items are specified,
345
returns a tuple of lookup values. Equivalent to::
346
347
- def itemgetter(*items):
348
- if len(items) == 1:
349
- item = items[0]
350
- def g(obj):
351
- return obj[item]
352
- else:
353
354
- return tuple(obj[item] for item in items)
355
- return g
+ def itemgetter(*items):
+ if len(items) == 1:
+ item = items[0]
+ def g(obj):
+ return obj[item]
+ else:
+ return tuple(obj[item] for item in items)
+ return g
356
357
The items can be any type accepted by the operand's :meth:`__getitem__`
358
method. Dictionaries accept any hashable value. Lists, tuples, and
0 commit comments