[issue9218] pop multiple elements of a list at once

Raymond Hettinger report at bugs.python.org
Mon Jul 12 08:53:17 CEST 2010

Raymond Hettinger <rhettinger at users.sourceforge.net> added the comment:

-1 on multi-popping.  The semantics aren't obvious -- is the order the same as s[-n:] or the same as a [s.pop() for i in range(n)] ?

Also, this is an unnecessary extension of the list API, one that has not been previously requested, nor is the extension something that other languages find it necessary to implement.  Besides, it already suffices to write:

  result = s[-n:]; del s[-n:]

I recommend that this be rejected in favor of keeping the API relatively small and clean.

nosy: +rhettinger

Python tracker <report at bugs.python.org>

More information about the Python-bugs-list mailing list