mirror of
https://github.com/python/cpython.git
synced 2025-07-24 11:44:31 +00:00
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. ........
This commit is contained in:
parent
58bfdcacee
commit
718ce2c2bd
1 changed files with 5 additions and 0 deletions
|
@ -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:
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue