gracetools.iterate_components_and_grace_containers_forward_in_expr

abjad.tools.gracetools.iterate_components_and_grace_containers_forward_in_expr.iterate_components_and_grace_containers_forward_in_expr(expr, klass)[source]

Iterate components of klass forward in expr:

abjad> voice = Voice("c'8 d'8 e'8 f'8")
abjad> spannertools.BeamSpanner(voice[:])
BeamSpanner(c'8, d'8, e'8, f'8)
abjad> grace_notes = [Note("c'16"), Note("d'16")]
abjad> gracetools.Grace(grace_notes, kind = 'grace')(voice[1])
Note("d'8")
abjad> after_grace_notes = [Note("e'16"), Note("f'16")]
abjad> gracetools.Grace(after_grace_notes, kind = 'after')(voice[1])
Note("d'8")
abjad> f(voice)
\new Voice {
    c'8 [
    \grace {
        c'16
        d'16
    }
    \afterGrace
    d'8
    {
        e'16
        f'16
    }
    e'8
    f'8 ]
}
abjad> for note in gracetools.iterate_components_and_grace_containers_forward_in_expr(voice, Note):
...     note
...
Note("c'8")
Note("c'16")
Note("d'16")
Note("d'8")
Note("e'16")
Note("f'16")
Note("e'8")
Note("f'8")

Include grace leaves before main leaves.

Include grace leaves after main leaves.

Changed in version 2.0: renamed iterate.grace() to componenttools.iterate_components_and_grace_containers_forward_in_expr().

This Page