What is the most efficient method to repeat a list up to a max element length?
To take this:
lst = ['one', 'two', 'three']
max_length = 7
And produce this:
final_list = ['one', 'two', 'three', 'one', 'two', 'three', 'one']
See also How to replicate array to specific length array for Numpy-specific methods.
See also Circular list iterator in Python for lazy iteration over such data.
itertools.cycleis only one way to solve the problem. Creating a definite list of data is different from being able to iterate over the data.