[Python-ideas] OrderedDict.peekitem()
Paul Sokolovsky
pmiscml at gmail.com
Mon Jul 6 17:38:29 CEST 2015
Hello,
On Mon, 06 Jul 2015 07:39:58 -0700
Kale Kundert <kale at thekunderts.net> wrote:
> Today I was trying to use collections.OrderedDict to manage a LIFO
> queue, and I was surprised to realize that OrderedDict doesn't
> provide a way to look at its first or last item. There is an
> OrderedDict.popitem() method, which removes and returns either the
> first or last item, but it's not hard to imagine cases where you
> would want to see what's on the queue without popping it right away.
What's wrong with using list, collections.Deque, heapq to manage a LIFO
queue?
--
Best regards,
Paul mailto:pmiscml at gmail.com
More information about the Python-ideas
mailing list