How can I force a dictionary in python to reject updates of existing keys?
Just check your dict before you add the item
if 'k' not in mydict:
mydict.update(myitem)
You can always create your own dictionary
class UniqueDict(dict):
def __setitem__(self, key, value):
if key not in self:
dict.__setitem__(self, key, value)
else:
raise KeyError("Key already exists")