Python's "pop" equivalent in Mathematica
TakeDrop[list,seq]
list = {1, 2, 2, 4, 5, 6};
seq = {2, 3};
pair = TakeDrop[list, seq] (* {{2, 2}, {1, 4, 5, 6}} *)
list = pair[[2]] (* {1, 4, 5, 6} *)
pop = pair[[1]] (* {2,2} *)
There is no direct equivalent. You could use something like this:
SetAttributes[pop, HoldFirst]
pop[list_, n_] := With[{item = list[[n]]}, list = Delete[list, n]; item]
mylist = {1, 2, 3, 4, 5};
pop[mylist, 4]
(* 4 *)
mylist
(* {1, 2, 3, 5} *)
Here is a simple way that I think mimics the Python script well.
myList = Range[5];
{value, myList} = {#, {##2}} & @@ myList;
Column[{value, myList}]