[issue20727] Improved roundrobin itertools recipe

2019-08-22 Thread Raymond Hettinger
Raymond Hettinger added the comment: Thanks for the suggestion. I appreciate it even though I've decided to keep the current recipe. While he proposed recipe is really good at eliminating exhausted input sources, it is slower at its core task of yielding outputs (which is typically the imp

[issue20727] Improved roundrobin itertools recipe

2014-02-28 Thread Chris Rebert
Changes by Chris Rebert : -- nosy: +cvrebert ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.pytho

[issue20727] Improved roundrobin itertools recipe

2014-02-25 Thread David Lindquist
David Lindquist added the comment: Thanks Gareth for your analysis. Very informative! -- ___ Python tracker ___ ___ Python-bugs-list m

[issue20727] Improved roundrobin itertools recipe

2014-02-25 Thread Gareth Rees
Gareth Rees added the comment: But now that I look at the code more carefully, the old recipe also has O(n^2) behaviour, because cycle(islice(nexts, pending)) costs O(n) and is called O(n) times. To have worst-case O(n) behaviour, you'd need something like this: from collections import deq

[issue20727] Improved roundrobin itertools recipe

2014-02-25 Thread Gareth Rees
Gareth Rees added the comment: I suspect I messed up the timing I did yesterday, because today I find that 100 isn't large enough, but here's what I found today (in Python 3.3): >>> from timeit import timeit >>> test = [tuple(range(300))] + [()] * 100 >>> timeit(lambda:list(roundrob

[issue20727] Improved roundrobin itertools recipe

2014-02-25 Thread Gareth Rees
Gareth Rees added the comment: If 100 doesn't work for you, try a larger number. -- ___ Python tracker ___ ___ Python-bugs-list mailin

[issue20727] Improved roundrobin itertools recipe

2014-02-24 Thread David Lindquist
David Lindquist added the comment: > other benchmarks show it to be more than twice as slow Can you share the method you used to get those results? Here's what I did: $ python -m timeit --number=100 --setup="from rr_mine import roundrobin" "its = ['ABC', 'D', 'EF']; list(roundrobin(*its))"

[issue20727] Improved roundrobin itertools recipe

2014-02-24 Thread Gareth Rees
Gareth Rees added the comment: > benchmarks show it to be more than twice as fast I'm sure they do, but other benchmarks show it to be more than twice as slow. Try something like: iterables = [range(100)] + [()] * 100 -- nosy: +Gareth.Rees ___

[issue20727] Improved roundrobin itertools recipe

2014-02-24 Thread David Lindquist
David Lindquist added the comment: Sure. That would be nice. :) Thanks Raymond and Larry -- ___ Python tracker ___ ___ Python-bugs-li

[issue20727] Improved roundrobin itertools recipe

2014-02-24 Thread Raymond Hettinger
Raymond Hettinger added the comment: Okay, after the RC then. David, would you like to be credited in the recipe? -- resolution: -> remind ___ Python tracker ___ __

[issue20727] Improved roundrobin itertools recipe

2014-02-24 Thread Larry Hastings
Larry Hastings added the comment: The patch attached to this issue has changes to Lib/test/test_itertools.py. -- ___ Python tracker ___ __

[issue20727] Improved roundrobin itertools recipe

2014-02-24 Thread Raymond Hettinger
Raymond Hettinger added the comment: It's a doc change only. Do you want it in the 3.4.0RC or in 3.4.1? -- ___ Python tracker ___ ___

[issue20727] Improved roundrobin itertools recipe

2014-02-24 Thread Larry Hastings
Larry Hastings added the comment: Doc changes are fine basically anytime, but I don't want low-priority changes in Lib for 3.4.0. But this would be fine for 3.4.1 if you like, or you could just wait for 3.5. -- ___ Python tracker

[issue20727] Improved roundrobin itertools recipe

2014-02-24 Thread Raymond Hettinger
Raymond Hettinger added the comment: I like the brevity and clarity of your version. If you would like, I can also add your name as the credit for the recipe. It is up to Larry whether this goes in before or after the 3.4 release. -- assignee: docs@python -> rhettinger nosy: +larry pr

[issue20727] Improved roundrobin itertools recipe

2014-02-22 Thread Antoine Pitrou
Changes by Antoine Pitrou : -- stage: -> patch review versions: -Python 3.1, Python 3.2, Python 3.5 ___ Python tracker ___ ___ Pytho

[issue20727] Improved roundrobin itertools recipe

2014-02-22 Thread Ned Deily
Changes by Ned Deily : -- nosy: +rhettinger ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python

[issue20727] Improved roundrobin itertools recipe

2014-02-21 Thread David Lindquist
New submission from David Lindquist: The roundrobin example in the Recipes section of the itertools documentation (http://docs.python.org/3/library/itertools.html#itertools-recipes) is overly complex. Here is a more straightforward implementation: def roundrobin(*iterables): "roundrobin('A