Containers, retrieving by nameΒΆ


Assembling a score means nesting containers:

>>> string = "d'8 f' a' d'' f'' gs'4 r8 e' gs' b' e'' gs'' a'4"
>>> voice = abjad.Voice(string, name="RH_Voice")
>>> staff = abjad.Staff([voice], name="RH_Staff")
>>> score = abjad.Score([staff], name="Score")
>>> abjad.show(score)

Use integer indices to retrieve nested containers:

>>> score[0]
Staff("{ d'8 f'8 a'8 d''8 f''8 gs'4 r8 e'8 gs'8 b'8 e''8 gs''8 a'4 }", name='RH_Staff')
>>> score[0][0]
Voice("d'8 f'8 a'8 d''8 f''8 gs'4 r8 e'8 gs'8 b'8 e''8 gs''8 a'4", name='RH_Voice')

Or use container names:

>>> score["RH_Staff"]
Staff("{ d'8 f'8 a'8 d''8 f''8 gs'4 r8 e'8 gs'8 b'8 e''8 gs''8 a'4 }", name='RH_Staff')
>>> score["RH_Voice"]
Voice("d'8 f'8 a'8 d''8 f''8 gs'4 r8 e'8 gs'8 b'8 e''8 gs''8 a'4", name='RH_Voice')