repeat_sequence_to_length

sequencetools.repeat_sequence_to_length(sequence, length, start=0)

Repeats sequence to nonnegative integer length.

Example 1. Repeats list to length 11:

>>> sequencetools.repeat_sequence_to_length(list(range(5)), 11)
[0, 1, 2, 3, 4, 0, 1, 2, 3, 4, 0]

Example 2. Repeats sequence to nonnegative integer length from start:

>>> sequencetools.repeat_sequence_to_length(
...     list(range(5)), 11, start=2)
[2, 3, 4, 0, 1, 2, 3, 4, 0, 1, 2]

Example 3. Repeats tuple to length 11:

>>> sequencetools.repeat_sequence_to_length(tuple(range(5)), 11)
(0, 1, 2, 3, 4, 0, 1, 2, 3, 4, 0)

Copies sequence element references; does not copy sequence elements.

Returns new object of sequence type.