I have the following code:
TESTS = ['C2P', 'FH', 'ACCURACY', 'DUPLICITY']
TESTING_LEVELS = ['IF', 'MF', 'MONO']
ALL_CAMERAS = ['main', 'fisheye_rectified', 'narrow', 'frontCornerLeft', 'frontCornerRight',
'rearCornerLeft', 'rearCornerRight', 'rear']
SET_A = dict.fromkeys(TESTING_LEVELS, dict.fromkeys(TESTS, dict.fromkeys(ALL_CAMERAS, False)))
SET_B = dict.fromkeys(TESTING_LEVELS, dict.fromkeys(TESTS, dict.fromkeys(ALL_CAMERAS, False)))
For some reason, the dictionaries under SET_A and SET_B point to the same location. From the Python documentation it seems that dict.fromkeys
creates new dictionaries. Why is this happening? Does it have something to do with the hashing-functions used to map the keys to the values?
Any help is much appreciated.