Dubslow <buns...@gmail.com> added the comment:

Note that this follows a bit of discussion on python-ideas, in two threads:

https://mail.python.org/pipermail/python-ideas/2017-November/047920.html

https://mail.python.org/pipermail/python-ideas/2017-November/047989.html

I agree the zip_longest-derived solution is both easier to read/understand and 
also not really accurate, especially in extreme cases.

But, and see the second thread, I think it might just be better to add this 
funcitonality itself to itertools, under the name zip_flat -- per the second 
thread, there's a lot of confusion around the topic beyond just the suitability 
of the current recipe (including such things as lack of a clear name, 
legibility, efficiency, and brevity -- a fair number of people are looking for 
one or two liners, even if that doesn't really exist). (One alternative to 
zip_flat would be to add a second keyword argument to zip_longest that 
*doesn't* use a fillvalue, producing variable-length tuples when the supplied 
iters run out. Then the recipe and the entire conversation/topic could be 
replaced by "yield from zip_longest(*iters, usefill=False)".)

Despite that opinion, this suggested change is better than nothing.

----------
nosy: +Dubslow

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue32099>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to