I am receiving a time sampled data. I can append to it until it reaches the length of n. After that, I would like to remove the first value and append the last value received to the end. This way I can always have the most recent n data.
I can do this by checking if the length is n and poping the first element.
if len(my_list) > n:
my_list.pop(0)
However is there a smarter way to do this?