You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Bug in ChainMap if one of the items is empty defaultdict #117576
If that is the case, then this isn't a bug. A defaultdict always shadows downstream mappings because is was specifically designed to always return some value whether or not a key is present.
Activity
pochmann3 commentedon Apr 6, 2024
You're not using
ChainMapand there is no output and you're doing the same thing twice...rhettinger commentedon Apr 6, 2024
I'm think the example was meant to look something like this:
If that is the case, then this isn't a bug. A defaultdict always shadows downstream mappings because is was specifically designed to always return some value whether or not a key is present.
erastogi commentedon Apr 11, 2024
Thanks for clarifying. When I was converting ChainMap to dict, it was overriding the latest value for key 3.
ericvsmith commentedon Apr 14, 2024
Since this doesn't seem to be a bug, I'm going to close this.