-
Notifications
You must be signed in to change notification settings - Fork 311
Proposal for new itertool postpend #780
Copy link
Copy link
Closed
Labels
pr-welcomeWe are open to PRs that fix this issue - leave a note if you're working on it!We are open to PRs that fix this issue - leave a note if you're working on it!
Description
Description
Would introduce
def postpend(iterator, value):
"""Yield the elements in *iterator* followed by value.
"""
return chain(iterator, [value])append is also a possible name, but clashes with list.append.
References
- Natural counterpart to
prepend, which already exists - Elementary operation on iterables, cf.
list.append
Examples
>>> value = '0'
>>> iterator = ['1', '2', '3']
>>> list(postpend(iterator, value))
[''1', '2', '3', '0']Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
pr-welcomeWe are open to PRs that fix this issue - leave a note if you're working on it!We are open to PRs that fix this issue - leave a note if you're working on it!