Dictionary With Lambda Values Updates All Entries
This is a typical late binding issue (see common gotchas): when the functions (being lambda/anonymous has nothing to do with it) are called, they access the current value of item, which is the last one from the loop. Try lambda x=item: x.data in your loop instead. This works since default arguments are bound to a … Read more