[issue13095] Support for splitting lists/tuples into chunks

2011-10-03 Thread Raymond Hettinger
Raymond Hettinger added the comment: These have been rejected before. There is always a trade-off in adding tools such as this -- it can take more time to learn and remember them than to write a trivial piece of code to do it yourself. Another issue is that people tend to disagree on how to

[issue13095] Support for splitting lists/tuples into chunks

2011-10-03 Thread Cal Leeming
Cal Leeming added the comment: Oh - and while we are at it - how about having merge_list() and unique_list() as part of the core too?? def unique_list(seq): # Dave Kirby # Order preserving seen = set() return [x for x in seq if x not in seen and not seen.add(x)] def merge_lis

[issue13095] Support for splitting lists/tuples into chunks

2011-10-03 Thread Ezio Melotti
Ezio Melotti added the comment: This sounds like the grouper() recipe of itertools. You could try to convince Raymond and see if he wants to include it in itertools. -- nosy: +ezio.melotti, rhettinger versions: +Python 3.3 ___ Python tracker

[issue13095] Support for splitting lists/tuples into chunks

2011-10-03 Thread Cal Leeming
New submission from Cal Leeming : After a while of digging around, I noticed that the core libs don't provide an easy way of splitting a list/tuple into chunks - as per the following discussion: http://www.aspwinhost.com/In-what-way-do-you-split-an-list-into-evenly-sized-chunks-on-Python/ The