mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
Add module specification: itemgetter -> operator.itemgetter (GH-12823)
This commit is contained in:
parent
9013ccf6d8
commit
b4c7f39bbf
1 changed files with 1 additions and 1 deletions
|
@ -827,7 +827,7 @@ which incur interpreter overhead.
|
||||||
"List unique elements, preserving order. Remember only the element just seen."
|
"List unique elements, preserving order. Remember only the element just seen."
|
||||||
# unique_justseen('AAAABBBCCDAABBB') --> A B C D A B
|
# unique_justseen('AAAABBBCCDAABBB') --> A B C D A B
|
||||||
# unique_justseen('ABBCcAD', str.lower) --> A B C A D
|
# 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):
|
def iter_except(func, exception, first=None):
|
||||||
""" Call a function repeatedly until an exception is raised.
|
""" Call a function repeatedly until an exception is raised.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue