Any way to keep track of the last 5 data points in python
<p>So I have an array that holds several numbers. As my script runs, more and more numbers are appended to this array. However, I am not interested in all the numbers but just want to keep track of the last 5 numbers.</p>

<p>Currently, I just store all the numbers in the array. However, this array gets really big and it's full of unnecessary information. </p>

<p>I have thought about making a function that when it adds an element to the array, also removes the last element if the array already contains 5 numbers. </p>

<p>I also thought about making a new class to create a data structure that does what I want. However, I only need to reference this array occasionally and is only a small part of the script. So I think it is overkill if I create a whole new class to do this. </p>

<p>What is the best way to do this?</p>
