Code is as follows:
interpretedData={'location 1':{},'location 2':{},'location 3':{},'location 4':{},'location 5':{},'location 6':{}}
# interpretedData gets further initialized elsewhere.
# SetData is called with one parameter (data) by a C++ application.
def SetData(data, d_list=interpretedData):
# data[0] is the name
# data[1] is the location
# data[2] is the amount left
d_list[str(data[1])][str(data[0])]=str(data[2])
interpretedData=d_list
global interpretedData
I ran into this gem today. It's a wonderful mindfuck, that took me a few minutes of staring before I realized why it worked in the way that it did work. I'll leave the simplified SetData() function as an exercise for all your entertainment. :)
A cookie for the person who explains why it essentially is a double mindfuck.