How can I update all Dictionary entries in place?

I believe that Dictionary.keys will capture a reference to the dictionary itself, and therefore you are better off using a for loop such as:

for (key, value) in dict {
  ...
}