A very interesting question which has an interesting answer.
The map
function returns a Map object which is iterable. map
is performing its calculation lazily so the function wouldn't get called unless you iterate that object.
So if you do:
x = map(D.attach_item, items)
for i in x:
continue
The expected result will show up.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…