Logged In: YES
user_id=6380
Well, there is a reason why it took Python 14+ years to grow
a specialized queue/deque datatype. One of Python's premises
is that having a small number of fast general data
structures is better than having many specialized ones, even
if the specialized ones are sometimes faster: msot of the
time you don't care so much about speed, and you just end up
wasting time worrying (or arguing :-) about the right choice
of data structure. Many Python programmers don't know O(n)
from O(1), and shouldn't have to care, because their
problems are never large enough for the difference to matter.
I would suggest that the deque should be used only in
situations where a concern for performance with a large
number of items is realistic, otherwise I fear we risk make
everyone speed freaks, worrying so much about optimizations
that they forget to write correct code first.
If you want examples, put them in the documentation; I'm not
for making small changes to the stdlib all the time to use
new features.
|