The list.pop(index) returns the element represented by the index and also 
reduces the list by removing that element. So it a short one liner for doing 
both things.
But when it comes for popping a slice of the list there is nothing similar for 
doing in that simple way.

If you want to remove a slice and also reduce the list you will have something 
like this:

a_list, a_slice = a_list[:size], a_list[size:]

or even worser if you try to do the same for something in the middle.

My proposal is the extension of list.pop for accepting a way for popping slices.

When doing this:

a_list.pop(i,j)

pop will return the slice [i,j] and remove it from the list.

For popping from an index to the end:

a_list.pop(i, len(a_list))

Or even emptying the whole list:

a_list.pop(0, len(a_list))


So this is it :)
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to