diff options
Diffstat (limited to 'Doc/tutorial/datastructures.rst')
-rw-r--r-- | Doc/tutorial/datastructures.rst | 5 |
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: |