-
Notifications
You must be signed in to change notification settings - Fork 116
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DictConfig silently ignores setdefault #304
Comments
Hi, it's really curious that this went undetected because OmegaConf is passing a strict mypy check. Since the intention is for OmegaConf DictConfig to be as compatible as possible with dict (with the exception of the base class) - I would like this to work. |
So it's because the method exists on the underlying base class, but it relies on |
[] throws a key error when struct mode is enabled. this is by design. changing this behavior for regular mode is a significant breaking change. Let's have our own implementation |
If you are using OmegaConf through Hydra, struct mode is becoming the default in 1.0. One more thing: |
Since you are actively working on it, setting the milestone to 2.0.1. |
👍 just to set expectations, I probably won't get to it until the weekend. |
That's fine. |
If I run the following code using omegaconf version 2.0.0 (Python 3.7.6, anaconda version):
I'll get the following output:
Observe that
'c'
does not get set bysetdefault
even thoughDictConfig
inherits fromMutableMapping
, which in its spec, states that it should supportsetdefault
.I feel like this should in order of preference:
DictConfig
API.Since I'm assuming none of these are that hard to implement, I could potentially implement the preferred solution myself. Just would want some guidance on which you think makes the most sense and, if it's the first option, what's the right way to do it.
The text was updated successfully, but these errors were encountered: