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

2014-06-22 Thread python
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? -- https://mail.python.org/mailman/listinfo/python-list

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

2014-06-22 Thread MRAB
On 2014-06-22 19:03, pyt...@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? When an item is popped from a list, all of the later

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

2014-06-22 Thread Terry Reedy
On 6/22/2014 2:03 PM, pyt...@bdurham.com wrote: Should I have any performance concerns with the index position used to pop() values off of large lists? Yes. While performance is generally not part of the language specification, in CPython seq.pop(i) is O(len(seq)-i) In other words, should

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

2014-06-22 Thread Ethan Furman
On 06/22/2014 11:03 AM, pyt...@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

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

2014-06-22 Thread python
MRAB, Terry, Ethan, and others ... Thank you - collections.deque is exactly what I was looking for. Malcolm -- https://mail.python.org/mailman/listinfo/python-list