Open fenom opened 3 years ago
@fenom I agree. The correct place to disable upserts is by subclassing dict
and replacing its update
method to disable upserts. Then you would pass your new subclass using the factory=MySubclass
keyword argument. dicttoolz.update_in
essentially delegates to the update
method of the mapping container.
I'm doing an update that is completely meaningless when the key doesn't already exist. I don't even want to use a default value. I just want to leave the key nonexistent. I know I can first see if get_in() is not None, but an option to disable upsert seems too natural to not have in an update function.