I am writing to a dict key, but several other keys get changed as well.
This code:
lead_data = result2[q['lead']]['data']
man_data = result2[q['lead']]['mans'][q['man']]
total_data = result2['total']
for i in range(0, 4):
w = 'w{n}'.format(n=i)
trips = q['trips{n}'.format(n=i)]
delta = q['delta{n}'.format(n=i)]
print(trips)
print(lead_data[w]['trips'])
lead_data[w]['trips'] += trips
print(lead_data[w]['trips'])
man_data[w]['trips'] += trips
print(lead_data[w]['trips'])
total_data[w]['trips'] += trips
print(lead_data[w]['trips'])
returns the following output (from print commands):
28
0
28
56
84
29
84
113
142
171
0
171
171
171
171
0
171
171
171
171
As you can see, the value of lead_data[w]['trips']
is changed with commands man_data[w]['trips'] += trips
and total_data[w]['trips'] += trips
as well. Which is extremely weird.
Anyone saw something similar?