Steven Bethard
2004-09-15 06:27:59 UTC
Even getitem/setitem were a stretch (they perform best at endpoints) and were
added to make deques substitutable for lists in stack/queue applications
using d[0] and d[-1] to implement peekleft() and peekright() operations.
Ahh, ok, so the functionality I was really looking for is peekleft(n). Thatadded to make deques substitutable for lists in stack/queue applications
using d[0] and d[-1] to implement peekleft() and peekright() operations.
is, a peek function that would return the first n items, starting at the
left. (If you're curious why I wanted this, see the peekable class in
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/304373.) I assumed
that the best way to get this was slicing, but are there plans for such a
peekleft function?
Steve