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

(cherry picked from commit 80d9ff1648)

Co-authored-by: Raymond Hettinger <rhettinger@users.noreply.github.com>
This commit is contained in:
Miss Islington (bot) 2021-09-16 22:12:37 -07:00 committed by GitHub
parent f798cef8aa
commit ed28b92e92
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: