it.ZipBy2 currently pads missing values with zero values when inputs have different lengths.
In some cases, a helper that stops as soon as either input is exhausted is safer and more useful. This matches the common “zip shortest” behavior used in many other languages and iterator libraries.
Proposal
Add a new helper in lo/it with “shortest input wins” semantics, for example:
ZipShortestBy2
ZipShortBy2
ZipBy2Shortest
Expected behavior
The helper should yield values only while both input sequences still have elements, and stop when either side ends.
This would help avoid subtle bugs caused by zero-value padding when input lengths differ.
it.ZipBy2currently pads missing values with zero values when inputs have different lengths.In some cases, a helper that stops as soon as either input is exhausted is safer and more useful. This matches the common “zip shortest” behavior used in many other languages and iterator libraries.
Proposal
Add a new helper in
lo/itwith “shortest input wins” semantics, for example:ZipShortestBy2ZipShortBy2ZipBy2ShortestExpected behavior
The helper should yield values only while both input sequences still have elements, and stop when either side ends.
This would help avoid subtle bugs caused by zero-value padding when input lengths differ.