[issue9380] Allow popping of n elements at once from a deque
report at bugs.python.org
Mon Jul 26 02:17:28 CEST 2010
Raymond Hettinger <rhettinger at users.sourceforge.net> added the comment:
Sorry, I'm going to reject this one.
Looking at implementations in other languages,
I see that this is almost never needed.
It is not worth complicating the API which
is currently very simple.
Also, there is an issue in that the semantics
are not self-evident. Is d.popnleft(n)
equal to [d.pop() for i in range(n)] or
is it equal to list(d)[:n]? Should it return
a list or deque? Should it raise an exception
if 0 < len(d) < n?
There are many uses possible operations that could
be added to deques (such as swap, pick, roll, etc)
but it is better to leave those for someone to
write their own utility functions. The important
thing for deques is to provide the building blocks.
assignee: -> rhettinger
resolution: -> rejected
status: open -> closed
versions: -Python 2.5, Python 2.6, Python 2.7, Python 3.1, Python 3.3
Python tracker <report at bugs.python.org>
More information about the Python-bugs-list