On Mon, Nov 20, 2017 at 12:15:50PM -0500, Terry Reedy wrote: > >Your version truncates the results to A B C instead of A B C D E as the > >itertools recipe gives. > > This is due to an off-by-1 error which I corrected 3 hours later in a > follow-up post, repeated below.
Ah, I missed that, thanks. > > def roundrobin(*iterables): > > "roundrobin('ABC', 'D', 'EF') --> A D E B F C" > > nexts = cycle(iter(it).__next__ for it in iterables) > > for reduced_len in reversed(range(1, len(iterables))): > > Make that 0 rather than 1 for start value. Is there a reason for calling reversed() instead of reversing the order of range in the first place? range(len(iterables)-1, -1, -1) -- Steve _______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/