iterate

topleveltools.iterate(client=None)

Makes iteration agent.

Example staff:

>>> staff = Staff("c'4 e'4 d'4 f'4")
>>> show(staff) 

Iterates staff by leaf pair:

>>> for pair in iterate(staff).by_leaf_pair():
...     pair
... 
Selection([Note("c'4"), Note("e'4")])
Selection([Note("e'4"), Note("d'4")])
Selection([Note("d'4"), Note("f'4")])

Iterates staff by pitch:

>>> for pitch in iterate(staff).by_pitch():
...     pitch
... 
NamedPitch("c'")
NamedPitch("e'")
NamedPitch("d'")
NamedPitch("f'")

Returns iteration agent:

>>> iterate(staff)
IterationAgent(client=Staff("c'4 e'4 d'4 f'4"))