summaryrefslogtreecommitdiffstats
path: root/Doc/tutorial/datastructures.rst
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2010-03-21 09:51:44 (GMT)
committerGeorg Brandl <georg@python.org>2010-03-21 09:51:44 (GMT)
commit718ce2c2bd96910c09ed4ad7a2cfcd0b31720fe3 (patch)
tree487782486ac830406915cd34edf302bedd1085f4 /Doc/tutorial/datastructures.rst
parent58bfdcaceed64a2107b5125c7ab7ff9396074b0e (diff)
downloadcpython-718ce2c2bd96910c09ed4ad7a2cfcd0b31720fe3.zip
cpython-718ce2c2bd96910c09ed4ad7a2cfcd0b31720fe3.tar.gz
cpython-718ce2c2bd96910c09ed4ad7a2cfcd0b31720fe3.tar.bz2
Merged revisions 79179 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r79179 | georg.brandl | 2010-03-21 10:37:54 +0100 (So, 21 Mär 2010) | 1 line Mention inefficiency of lists as queues, add link to collections.deque discussion. ........
Diffstat (limited to 'Doc/tutorial/datastructures.rst')
-rw-r--r--Doc/tutorial/datastructures.rst5
1 files changed, 5 insertions, 0 deletions
diff --git a/Doc/tutorial/datastructures.rst b/Doc/tutorial/datastructures.rst
index ef364b2..8cf58c8 100644
--- a/Doc/tutorial/datastructures.rst
+++ b/Doc/tutorial/datastructures.rst
@@ -153,6 +153,11 @@ the queue, use :meth:`pop` with ``0`` as the index. For example::
>>> queue
['Michael', 'Terry', 'Graham']
+However, since lists are implemented as an array of elements, they are not the
+optimal data structure to use as a queue (the ``pop(0)`` needs to move all
+following elements). See :ref:`tut-list-tools` for a look at
+:class:`collections.deque`, which is designed to work efficiently as a queue.
+
.. _tut-listcomps: