listtools.overwrite_slices_at — Abjad v1.1.1 documentation

### Navigation

- index
- modules |
- next |
- previous |
- Project Abjad »
- Abjad v1.1.1 documentation »
- Abjad API »

# listtools.overwrite_slices_at

`abjad.tools.listtools.` `overwrite_slices_at`(l, pairs)

  Overwrite slices in l according to pairs.

  - pairs must be a list `(anchor_index, length)` pairs. The function then copies the value of `l[anchor_index]` over `l[anchor_index + 1]`, `l[anchor_index + 2]`, ..., `l[anchor_index + length - 1]`.

  Return new list.

      abjad> l = range(10)
      listtools.overwrite_slices_at(l, [(0, 3), (5, 3)])
      [0, 0, 0, 3, 4, 5, 5, 5, 8, 9]

      abjad> l = range(10)
      listtools.overwrite_slices_at(l, [(0, 99)])
      [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]

  Todo

  Implement optional `period` keyword.

  Todo

  Read anchor_index and length values cyclically.

### Navigation

- index
- modules |
- next |
- previous |
- Project Abjad »
- Abjad v1.1.1 documentation »
- Abjad API »