With standard dicts, setdefault doesn't modify an existing key which is False/None (satisfies the condition of not x), whereas a flatdict will:
import flatdict
example = {'test': False}
example.setdefault('test', None)
print(example) # 'test' will still be False
example = flatdict.FlatDict(example)
example.setdefault('test', None)
print(example) # 'test' will now be None
With standard dicts, setdefault doesn't modify an existing key which is False/None (satisfies the condition of
not x
), whereas a flatdict will:The culprit line is https://github.com/gmr/flatdict/blob/88c043438a174eb82aa7d688fe5af04bc647a72a/flatdict.py#L318 (specifically the
or not self.__getitem__(key)
part).