def __setitem__(self, key, value):
    self._values.append(value)
self._key_to_index[key] = len(self._values) - 1

def reset_content_to_zero(self):
    zero_string = '\x00' * self._values.itemsize * len(self._values)
self._values = array.array(self._value_type, zero_string)
fast_reset_dict = FastResetDict('i')
fast_reset_dict['a'] = 103
fast_reset_dict['b'] = -99
print(fast_reset_dict['a'], fast_reset_dict['b'])
fast_reset_dict.reset_content_to_zero()
print(fast_reset_dict['a'], fast_reset_dict['b'])
Simultaneously replacing all values of a dictionary to zero python