containertools.repeat_last_n_elements_of_container

abjad.tools.containertools.repeat_last_n_elements_of_container.repeat_last_n_elements_of_container(container, n=1, total=2)[source]

New in version 1.1.

Repeat last n elements of container:

abjad> staff = Staff("c'8 d'8 e'8 f'8")
abjad> spannertools.BeamSpanner(staff.leaves)
BeamSpanner(c'8, d'8, e'8, f'8)
abjad> f(staff)
\new Staff {
    c'8 [
    d'8
    e'8
    f'8 ]
}
abjad> containertools.repeat_last_n_elements_of_container(staff, n = 2, total = 3)
Staff{8}
abjad> f(staff)
\new Staff {
    c'8 [
    d'8
    e'8
    f'8 ]
    e'8 [
    f'8 ]
    e'8 [
    f'8 ]
}

Return container.

Changed in version 2.0: renamed containertools.extend_cyclic() to containertools.repeat_last_n_elements_of_container().

This Page