New in version 1.1.
Iterate components forward in expr:
abjad> container = Container(Voice(notetools.make_repeated_notes(2)) * 2)
abjad> container.is_parallel = True
abjad> container[0].name = 'voice 1'
abjad> container[1].name = 'vocie 2'
abjad> staff = Staff(container * 2)
abjad> pitchtools.set_ascending_named_diatonic_pitches_on_nontied_pitched_components_in_expr(staff)
abjad> f(staff)
\new Staff {
<<
\context Voice = "voice 1" {
c'8
d'8
}
\context Voice = "vocie 2" {
e'8
f'8
}
>>
<<
\context Voice = "voice 1" {
g'8
a'8
}
\context Voice = "vocie 2" {
b'8
c''8
}
>>
}
abjad> for x in componenttools.iterate_components_forward_in_expr(staff, Note):
... x
...
Note("c'8")
Note("d'8")
Note("e'8")
Note("f'8")
Note("g'8")
Note("a'8")
Note("b'8")
Note("c''8")
New in version 2.0: optional start and stop keyword parameters.
abjad> for x in componenttools.iterate_components_forward_in_expr(staff, Note, start = 0, stop = 4):
... x
...
Note("c'8")
Note("d'8")
Note("e'8")
Note("f'8")
abjad> for x in componenttools.iterate_components_forward_in_expr(staff, Note, start = 4):
... x
...
Note("g'8")
Note("a'8")
Note("b'8")
Note("c''8")
abjad> for x in componenttools.iterate_components_forward_in_expr(staff, Note, start = 4, stop = 6):
... x
...
Note("g'8")
Note("a'8")
This function is thread-agnostic.
Changed in version 2.0: renamed iterate.naive() to componenttools.iterate_components_forward_in_expr().
Changed in version 2.0: klass now defaults to Component.