-
Notifications
You must be signed in to change notification settings - Fork 111
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
Deprecate OmegaConf.is_none()
#547
Milestone
Comments
This was referenced Feb 17, 2021
I like this -- |
odelalleau
added a commit
to odelalleau/omegaconf
that referenced
this issue
Mar 10, 2021
odelalleau
added a commit
to odelalleau/omegaconf
that referenced
this issue
Mar 10, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
PROBLEM
With the change to
OmegaConf.is_missing()
in #545, the current behavior ofOmegaConf.is_none()
in OmegaConf 2.0 can be confusing (because it resolves interpolations, whileOmegaConf.is_missing()
doesn't).In addition,
OmegaConf.is_none()
has potentially non-intuitive behavior in situations where the key can't be resolved (see below for details).SOLUTION
OmegaConf.is_none()
is being deprecated in OmegaConf 2.1, and will be removed in OmegaConf 2.2MIGRATION INSTRUCTIONS
Please do not hesitate to open an issue if you run into problems that the instructions below do not address.
Scenario 1 -- Your code is checking a specific key:
It is recommended to change these to:
Note however that when using this new syntax, an exception may be raised when accessing the key, while
OmegaConf.is_none()
used to silence such exceptions. If you want to keep the exact (but possibly unintuitive) behavior from before, you can implement your ownis_none()
function as follows:Scenario 2 -- Your code is not providing a key:
There is currently no plan to keep supporting this usage in OmegaConf 2.2. If you need it, please open an issue explaining why.
Additional context
See discussion in #545 (comment)
Dev note: at the same time, the internal
Node._is_none()
can be modified to not resolve interpolations.The text was updated successfully, but these errors were encountered: