Add module specification: itemgetter -> operator.itemgetter (GH-12823)

This commit is contained in:
Jakub Molinski 2019-04-23 10:30:30 +02:00 committed by Raymond Hettinger
parent 9013ccf6d8
commit b4c7f39bbf
1 changed files with 1 additions and 1 deletions

View File

@ -827,7 +827,7 @@ which incur interpreter overhead.
"List unique elements, preserving order. Remember only the element just seen."
# unique_justseen('AAAABBBCCDAABBB') --> A B C D A B
# unique_justseen('ABBCcAD', str.lower) --> A B C A D
return map(next, map(itemgetter(1), groupby(iterable, key)))
return map(next, map(operator.itemgetter(1), groupby(iterable, key)))
def iter_except(func, exception, first=None):
""" Call a function repeatedly until an exception is raised.