-
Notifications
You must be signed in to change notification settings - Fork 122
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
Interpolations can't refer to non-string keys #651
Comments
Non string keys are new in 2.1, so there are no backward compatibility concerns. I am also okay with adding support for it, but I think it's optional for 2.1 (not instead of anything already in the 2.1 list). |
The potential concern would be that if we implement it, then
Since interpolations are based on
Agreed, I'd rather not try and address it in 2.1. |
DictConfig with Any can also have both "0" and 0 as keys at the same time. In [12]: cfg = OmegaConf.create({1: 1, "1": 2})
In [13]: cfg[1]
Out[13]: 1
In [14]: cfg["1"]
Out[14]: 2 I guess your concern is that implementing your proposal to use the grammar to differentiate will break such cases. I also have concerns about the ability of a regex to handle all cases:
I think it makes more sense to me to use the type declared on the DictConfig. |
My concern was simply to ensure that
Right now we don't support interpolations in node keys (this is #610).
That would probably work too. |
Tentative for 2.1, if we can fix it without grammar change. |
Bouncing to 2.2. |
Describe the bug
If a
DictConfig
is using non-string keys, interpolations can't access them:There are probably similar issues with other non-string key types.
Expected behavior
Ideally, I think keys should be cast to their corresponding type according to the grammar (which would need to be updated to allow this). Previous behavior could be preserved to maintain backward compatibility and keep things simple and intuitive (i.e.,
${0}
could still refer to the node with key"0"
if there is no node with key0
)Side note
OmegaConf.select()
doesn't seem to support non-string keys either.The text was updated successfully, but these errors were encountered: