What follows is a trick to refactor a local variable, best used if the variable occurs many times within a local scope.
In the screenshot below, I highlighted the local variable dict and then entered Control-Command-T. Notice that each reference to this variable is now highlighted. An important note, you don’t need to necessarily highlight the first instance of the variable for this to work.
Once all the variables are highlighted, make the change to the new name and you’ll see all references updated in unison, see the figure below:
Tap your mouse anywhere outside the variable to complete the change.