gmr / flatdict

Python module for interacting with nested dicts as a single level dict with delimited keys.
https://flatdict.readthedocs.io
BSD 3-Clause "New" or "Revised" License
112 stars 32 forks source link

FlatDict flattens empty dictionary as FlatDict object rather than {} #48

Closed devleaks closed 2 years ago

devleaks commented 2 years ago
>>> import flatdict
>>> print(flatdict.FlatDict({"test": {}}))
{'test': <FlatDict id=140555892896048 {}>"}

Empty dict {} does not get flattened as {} but remains as FlatDict object. (Same with FlatterDict.) P.

gmr commented 2 years ago

This is expected behavior. You'd need to coerce it to a dict for it to be a dict, it's part of the core behavior.