Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #73500 > unrolled thread
| Started by | MRAB <python@mrabarnett.plus.com> |
|---|---|
| First post | 2014-06-22 19:16 +0100 |
| Last post | 2014-06-22 19:16 +0100 |
| 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.
Re: Are there performance concerns with popping from front of long lists vs. the end of long lists? MRAB <python@mrabarnett.plus.com> - 2014-06-22 19:16 +0100
| From | MRAB <python@mrabarnett.plus.com> |
|---|---|
| Date | 2014-06-22 19:16 +0100 |
| Subject | Re: Are there performance concerns with popping from front of long lists vs. the end of long lists? |
| Message-ID | <mailman.11190.1403460981.18130.python-list@python.org> |
On 2014-06-22 19:03, python@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 items (they are actually references to each item) are moved down. Therefore, popping the last item is fast, but popping the first item is slow. If you want to pop efficiently from both ends, then a deque is the correct choice of container.
Back to top | Article view | comp.lang.python
csiph-web