implementing dynamic array although the python list class provides highly optimized implementation of dynamic arraysupon which we rely for the remainder of this bookit is instructive to see how such class might be implemented the key is to provide means to grow the array that stores the elements of list of coursewe cannot actually grow that arrayas its capacity is fixed if an element is appended to list at time when the underlying array is fullwe perform the following steps allocate new array with larger capacity set [ia[ ]for where denotes current number of items set bthat iswe henceforth use as the array supporting the list insert the new element in the new array an illustration of this process is shown in figure (aa ( (cfigure an illustration of the three steps for "growinga dynamic array(acreate new array (bstore elements of in (creassign reference to the new array not shown is the future garbage collection of the old arrayor the insertion of the new element the remaining issue to consider is how large of new array to create commonly used rule is for the new array to have twice the capacity of the existing array that has been filled in section we will provide mathematical analysis to justify such choice in code fragment we offer concrete implementation of dynamic arrays in python our dynamicarray class is designed using ideas described in this section while consistent with the interface of python list classwe provide only limited functionality in the form of an append methodand accessors len and getitem support for creating low-level arrays is provided by module named ctypes because we will not typically use such low-level structure in the remainder of this bookwe omit detailed explanation of the ctypes module insteadwe wrap the necessary command for declaring the raw array within private utility method make array the hallmark expansion procedure is performed in our nonpublic resize method