Fix typo and add a module prefix (GH-28401)

This commit is contained in:
Raymond Hettinger 2021-09-16 23:49:41 -05:00 committed by GitHub
parent fdc6b3d931
commit 80d9ff1648
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -821,14 +821,14 @@ which incur interpreter overhead.
def triplewise(iterable):
"Return overlapping triplets from an iterable"
# pairwise('ABCDEFG') -> ABC BCD CDE DEF EFG
# triplewise('ABCDEFG') -> ABC BCD CDE DEF EFG
for (a, _), (b, c) in pairwise(pairwise(iterable)):
yield a, b, c
def sliding_window(iterable, n):
# sliding_window('ABCDEFG', 4) -> ABCD BCDE CDEF DEFG
it = iter(iterable)
window = deque(islice(it, n), maxlen=n)
window = collections.deque(islice(it, n), maxlen=n)
if len(window) == n:
yield tuple(window)
for x in it: