Skip to main content

lookahead

Yield pairs of (current, next) items in it.

def lookahead(
it: iterable
) - > zip_longest

Yield pairs of (current, next) items in it.

Parameters

NameTypeDescription
ititerableThe input sequence or generator to be processed into lookahead pairs.

Returns

TypeDescription
zip_longestAn iterator of tuples where each tuple contains the current item and the subsequent item from the input iterable, with None as the final 'next' value.