I was playing around with deque today, and there were a couple of
operations I wanted to do, that can't really be done efficiently with deque
because of its implementation.

I was iterating through items of a deque, and in some cases I wanted to
delete an item that I've found. As far as I understand, this is an
operation that should be O(1) in a linked list, but Python only provides an
O(N) way to do that, which is `del d[i]`.

The same can be said for inserting items in the middle.

What do you think about adding this to `deque`? The API will be tricky,
admittedly, because you'll have to save some kind of reference to a cell in
the deque.


Thanks,
Ram.
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/C4BASDFJI5UGAAV3AR4VELNFD2XQE4YV/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to