Python overwriting and resizing list
<p>I want to create a list in python of a fixed size, let's so 3 to begin with. I have a method that writes data to this list every time the method is called, I want to add this to the list until the list is full, once the list is full it should start overwriting the data in the list in ascending order (e.g. starting with element 0). I also want to add a function which will increase the length of the array, i.e. if the method is called the array will increase from size 3 to size 4. How do I go about doing either of these?</p>

<p>Here is how I went about it in the end. I set a variable called length_list which was originally set at 3. </p>

<pre><code>def add_to_list():

   if len(list) &lt; length_list:
      append
   else:
      del list[0]
   self.add_to_list()

def increase_length():
    length_list += 1
</code></pre>

python arrays list