Suggestion: PEP for popping slices from lists

Joshua Landau joshua at landau.ws
Thu Aug 8 17:32:27 EDT 2013


On 8 August 2013 21:03, Terry Reedy <tjreedy at udel.edu> wrote:
> If .pop were being added today, I would argue against including the index
> parameter.

GASP! That's no fair!

1) When using pop you normally want to keep the mutability available,
so iter(mylist) is a no-go.
2) When using the index, it's often somewhere in the middle that
you're popping from
3) There's always deque for deques

That said you can always use blist which has O(log n) time complexity
for these pops. It's a hassle it's not stdlib :/.



More information about the Python-list mailing list