[issue21414] Add an intersperse function to itertools
Raymond Hettinger added the comment: I've looked into this a bit more. Even in Haskell, it seems that use case is for str.join() which we already have. I don't see intersperse() in any other functional languages. That suggests that its use cases aren't sufficiently common to warrant adding it to the standard library. Thank you for the submission. -- resolution: - rejected status: open - closed ___ 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
[issue21414] Add an intersperse function to itertools
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
[issue21414] Add an intersperse function to itertools
Changes by Chris Rebert pyb...@rebertia.com: -- nosy: +cvrebert ___ 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
[issue21414] Add an intersperse function to itertools
Éric Araujo added the comment: I looked for a previous discussion of this on the Python mailing lists and found nothing. Existing solutions include https://twitter.com/snim2/status/393821419114483712 and http://stackoverflow.com/questions/5655708/python-most-elegant-way-to-intersperse-a-list-with-an-element Raymond is the one to decide whether this should be added. If he doesn't comment in the near future, feel free to propose this on python-ideas to see if people like it. You may also want to ask maintainers of projects like more-itertools if they have a similar function and if people use it. -- nosy: +eric.araujo, rhettinger ___ 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
[issue21414] Add an intersperse function to itertools
Changes by Terry J. Reedy tjre...@udel.edu: -- versions: +Python 3.5 ___ 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
[issue21414] Add an intersperse function to itertools
Raymond Hettinger added the comment: What is the use case for interspersing values? I've not run across anything like it ever before. -- assignee: - rhettinger ___ 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