You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee='https://github.com/rhettinger'closed_at=<Date2014-05-04.02:13:34.387>created_at=<Date2014-05-02.07:39:41.789>labels= ['type-feature']
title='Add an intersperse function to itertools'updated_at=<Date2014-05-04.02:13:34.385>user='https://bugs.python.org/javawizard'
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.
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.
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.
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: