New submission from Alexander Boyd: Itertools would benefit greatly from a function (which I've named intersperse, after Haskell's equivalent) for yielding the items of an iterator with a given value placed between each. Sort of a str.join-like function, but for arbitrary sequences.
Something like: >>> list(itertools.intersperse(1, [2, 3, 4])) [2, 1, 3, 1, 4] ---------- messages: 217746 nosy: javawizard priority: normal severity: normal status: open title: Add an intersperse function to itertools type: enhancement _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue21414> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com