Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #73503 > unrolled thread

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

Started byTerry Reedy <tjreedy@udel.edu>
First post2014-06-22 14:33 -0400
Last post2014-06-22 14:33 -0400
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Are there performance concerns with popping from front of long lists vs. the end of long lists? Terry Reedy <tjreedy@udel.edu> - 2014-06-22 14:33 -0400

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

FromTerry Reedy <tjreedy@udel.edu>
Date2014-06-22 14:33 -0400
SubjectRe: Are there performance concerns with popping from front of long lists vs. the end of long lists?
Message-ID<mailman.11192.1403462020.18130.python-list@python.org>
On 6/22/2014 2:03 PM, python@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 pop(0) and pop() be time equivalent operations
> with long lists?

No. If you want this, use collections.deque.


-- 
Terry Jan Reedy

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web