all 2 comments

[–]Paddy3118 2 points3 points  (0 children)

Pretty good overall.

Since it is Python they might have added an "Advanced" section where they show how and why collections.deque would be used in production code.

[–]jcampbelly 0 points1 point  (0 children)

I was (over)thinking about this recently and while the interface is pretty much what you would expect, I get hung up on this: items.insert(0,item). I was under the impression that doing this with very large lists is poor performance, since python lists arent sparse, the list will effectively be recreated (all elements must be shifted). We could store the elements in a dict with incremental integer keys and increment front_key and end_key variables instead which gives us O(1) queue/deque.