Feature Requests item #1757395, was opened at 2007-07-20 10:12 Message generated for change (Tracker Item Submitted) made by Item Submitter You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=355470&aid=1757395&group_id=5470
Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Python Library Group: Python 2.6 Status: Open Resolution: None Priority: 5 Private: No Submitted By: Alexander Dutton (asdutton) Assigned to: Nobody/Anonymous (nobody) Summary: splice() function for itertools Initial Comment: Could we have a splice function in itertools? I see there was once a roundrobin proposal (#756253), but it was three years ago ... Here's an alternate implementation: def splice(*args): """splice(*iterables) --> iterator Returns an iterator whose next() method returns an element from each of the iterables in turn before starting again with the first iterable.""" iters = list(args) n = len(iters) i = 0 while n>0: i %= n try: yield iters[i].next() i += 1 except StopIteration, e: n -= 1 iters[i:i+1] = [] raise StopIteration ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=355470&aid=1757395&group_id=5470 _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com