del self._deletes

def __delitem__(self, key):
    if key not in self._dict:
        raise KeyError(str(key))
self._deletes.add(key)
d = dict(a=1, b=2, c=3)
with deferring_delete(d) as dd:
    for k, v in d.items():
        if k is 'a':
            del dd[k]
print(d)
custom dict that allows delete during iteration