Are there performance concerns with popping from front of long lists vs. the end of long lists?

Ethan Furman ethan at stoneleaf.us
Sun Jun 22 14:18:18 EDT 2014


On 06/22/2014 11:03 AM, python at bdurham.com wrote:
>
> Should I have any performance concerns with the index position used
> to pop() values off of large lists? In other words, should pop(0) and
>  pop() be time equivalent operations with long lists?

I believe lists are optimized for adding and removing items from the end, so anywhere else will have an impact.  You'll 
have to do measurements to see if the impact is worth worrying about in your code.

--
~Ethan~



More information about the Python-list mailing list