-
Notifications
You must be signed in to change notification settings - Fork 152
Description
@cmbant let's see what you think about this:
Let's define the following dicts:
dict_x = {
"a": "b"
}
dict_y = {
"a": {
"b": {
"b_opt_1": "b_val_1",
}
}
}
If dict_x represents the defaults for a class, then recursive_update(dict_x, dict_y) should return dict_y, do we agree? (It fails at the moment; I have an easy fix.)
OTOH, if we invert the roles and dict_y is the default, it is not clear what should happen with recursive_update(dict_y, dict_x): should it keep the internal "b_opt_1": "b_val_1" for the b key/value, or should it drop it and return dict_x? (right now, the latter happens)
To make it a little harder, notice that if we define dict_x in the cobaya-equivalent way:
dict_x_alt = {
"a": {"b": None}
}
then recursive_update(dict_x_alt, dict_y) == recursive_update(dict_y, dict_x_alt) == dict_y, so there is at least an inconsistency there (recursive_update(dict_y, dict_x) != recursive_update(dict_y, dict_x_alt)), regardless of how we want to treat these "deep defaults".