Consider adding `repeat_each` to itertoolz
Open
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 5.2k
- Forks
- 280
- Avg merge
- 6d 17h
- Merged PRs (30d)
- 4
Description
I wrote this today and was a bit surprised that it wasn't already in toolz:
def repeat_each(elems, n):
"""
Repeat each element in elems N times.
>>> repeat_each([1, 2, 3], 3)
[1, 1, 1, 2, 2, 2, 3, 3, 3]
"""
return concat(zip(*tee(elems, n)))
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the itertoolz module and the existing concat and tee utilities. Compare the proposed repeat_each behavior with nearby helpers, then verify that repeating each input element produces the documented sequence and that the relevant existing tests still pass.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100