The reason the keys in bar are being sorted alphabetically is that in AttrDict.unionkeys_nested is being called, which sorts keys before returning them nested. bar then has its (sorted) keys iterated over to merge into foo, hence why the keys from foo are not sorted.
To achieve what I think would be more intuitive (and more useful when adding user-defined YAML math) behaviour, we should remove key sorting when calling keys_nested.
What happened?
This is intended behaviour, but it is silent and probably not what we actually want it to do:
Say we have:
We get:
I would expect the result to actually be:
The reason the keys in
bar
are being sorted alphabetically is that inAttrDict.union
keys_nested
is being called, which sorts keys before returning them nested.bar
then has its (sorted) keys iterated over to merge intofoo
, hence why the keys fromfoo
are not sorted.To achieve what I think would be more intuitive (and more useful when adding user-defined YAML math) behaviour, we should remove key sorting when calling
keys_nested
.Which operating systems have you used?
Version
v0.7.0.dev3
Relevant log output
No response