New in version 1.1.
Truncate sequence to weight:
abjad> from abjad.tools import sequencetools
abjad> l = [-1, 2, -3, 4, -5, 6, -7, 8, -9, 10]
abjad> for x in range(10):
... print x, sequencetools.truncate_sequence_to_weight(l, x)
...
0 []
1 [-1]
2 [-1, 1]
3 [-1, 2]
4 [-1, 2, -1]
5 [-1, 2, -2]
6 [-1, 2, -3]
7 [-1, 2, -3, 1]
8 [-1, 2, -3, 2]
9 [-1, 2, -3, 3]
Return empty list when weight is 0:
abjad> sequencetools.truncate_sequence_to_weight([1, 2, 3, 4, 5], 0)
[]
Raise type error when sequence is not a list.
Raise value error on negative weight.
Return new list.
Changed in version 2.0: renamed sequencetools.truncate_to_weight() to sequencetools.truncate_sequence_to_weight().