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


Groups > comp.lang.python > #73503

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

From Terry Reedy <tjreedy@udel.edu>
Subject Re: Are there performance concerns with popping from front of long lists vs. the end of long lists?
Date 2014-06-22 14:33 -0400
References <1403460221.20360.131626817.5EFAE11B@webmail.messagingengine.com>
Newsgroups comp.lang.python
Message-ID <mailman.11192.1403462020.18130.python-list@python.org> (permalink)

Show all headers | View raw


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

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

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

csiph-web