[Python-ideas] Operator for inserting an element into a list

Michael Selik mike at selik.org
Tue Jun 12 21:04:41 EDT 2018

On Tue, Jun 12, 2018 at 4:43 PM Mikhail V <mikhailwas at gmail.com> wrote:

> inserting in the beginning of the list may be also not rare.

Inserting in the beginning of a list is *slow* and should be rare.
If you want to append to the left-side of a list, you should use a deque.
Check out ``collections.deque`` for your insert(0, x) needs.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20180612/67ecc07b/attachment-0001.html>

More information about the Python-ideas mailing list