python has several elements of functional languages like lazy evaluation, which postpones execution until the computation result is needed. When calling
map(outer.remove, inner)
you are creating a mapping object, which will not apply dirty method remove
to inner list until the computation "result" is actually demanded. Like e.g. when you put it on the list (which is immediately lost from the scope)
list(map(outer.remove, inner))
imho it`s generally a bad practice to mix functional programming and functions with side effects
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…