Some of the data that makes up the objects returned from the Ensembl API is lazy loaded. By using lazy loading, we are able to minimize the number of database queries and only "fill in" the data in the object that the program actually asked for. This makes the code faster and its memory footprint smaller, but it also means that the more data that the program requests from an object the larger it becomes. The consequence of this is that looping over a large number of these objects in some cases might grow the memory footprint of the program considerably. By using a while-shift loop rather than a foreach loop, the growth of the memory footprint due to lazy loading of data is more likely to stay small. This is why the comment on the last loop above says that it is a "more memory efficient way", and this is also why we use this convention for most similar loop constructs in the remainder of this API tutorial. NB: This strategy obviously won't work if the contents of the list being iterated over is needed at some later point after the end of the loop.