When I do this:
i = [5, 6, 7, 5]
for el in i:
el = 2
print(i)
# [5, 6, 7, 5]
the list is not updated (which is a trivial observation for someone who knows Python).
But when I do this:
i = [{'id': 5}, {'id': 6}, {'id': 7}, {'id': 5}]
for el in i:
el['id'] = 2
print(i)
# [{'id': 2}, {'id': 2}, {'id': 2}, {'id': 2}]
then the list is updated.
Why is this exactly happening?
Even if a list of dicts is updated in this way, is this considered a bad technique to do something like that?