How would you extract items 3..6 efficiently, elegantly and pythonically from the following deque without altering it:
from collections import deque
q = deque('',maxlen=10)
for i in range(10,20):
q.append(i)
the slice notation doesn’t seem to work with deque…
For example:
This should be more efficient the the other solutions posted so far. Proof?