Speed revisited

Kent Johnson kent3737 at yahoo.com
Sun Jan 9 20:31:58 EST 2005


Andrea Griffini wrote:
> I've to admit that I also found strange that deleting the
> first element from a list is not O(1) in python. My wild
> guess was that the extra addition and normalization required
> to have insertion in amortized O(1) and deletion in O(1) at
> both ends of a random access sequence was going to have
> basically a negligible cost for normal access (given the
> overhead that is already present in python).

This was added to Python 2.4 as collections.deque

Kent



More information about the Python-list mailing list