Is there any efficient implementation for iterating over a list and updating the corresponding value in a dictionary? What I want to do is shown in the code below:
for i in range(n): for j in range(i+1, n): update( dict[ (data[i], data[j]) ] )
Clearly update is a function and data is a list.
update
data
2.1m questions
2.1m answers
60 comments
57.0k users