My 2 cents :
Another way to achieve this would also be to take advantage of the fact you can multiply lists in Python.
>>> l = [1, 2, 3]
>>> [1, 2, 3] * 3
[1, 2, 3, 1, 2, 3, 1, 2, 3]
A simple call to the sorted
function allows to sort it back :
>>> b = 3
>>> l = [1, 2]
>>> sorted(l * b)
[1, 1, 1, 2, 2, 2]