Added pairwise iteration algorithms - #9645
Conversation
|
Need reviews, please! |
|
@chriso345 need reviews, please! |
|
@priya-sundaram-dev, please review. |
|
Thanks for the PR, @matheusfvesco, and for your patience — I took a careful pass. 🙂 What works: the code is clean and the docstrings are genuinely nice. I checked out the branch and ran the doctests: 16 tests in 3 items, 16 passed / 0 failed on Python 3.12, and I spot-checked the dict/set/string cases by hand — all correct. The A couple of things worth discussing before merge:
None of these are hard blockers; if you fold #1 and #2 in, I think this is in good shape. Nice work! 👍 |
|
Nice review! I love yielding (just-in-time -- stream-flow delivery of) data to the caller. |
Updated documentation to clarify the use of pairwise iteration and added a reference to the itertools.pairwise function.
Fix import statement for pairwise in pairwise_iteration_tee function and update test cases.
Added docstring explaining the use of itertools.tee for independent iterators.
Could you please add the hacktoberfest label to this PR, if possible, please?
Describe your change:
Added a pairwise iteration algorithm. It will iterate over any iterable, yielding tuples that represent (iterable[i],iterable[i+1]). Second implementation allows specifying a step size. This algorithm can be useful for various domains, like:
Couldn't find any wikipedia articles for this algorithm.
Checklist: