-
Notifications
You must be signed in to change notification settings - Fork 101
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
Unstable hash for different data input order #1049
Comments
To push back on this, The order of keys in a python dict is part of the dict's api. |
I understand. Thanks for the reply. It's fine to leave it as a is, but I'd just point out that this only seems to be stable for python>=3.7, so in older python versions you could actually see the same object have different hashes upon a read event or such. |
OmegaConf is soon dropping support for python3.6 anyway. (#791). |
It seems correct that hash of equal DictConfigs is the same if the objects are considered equal by |
Describe the bug
The hash of a DictConfig is not stable.
hash(cfg)
changes although python dict comparison returns true.The problem for me is that when reading from a yaml file, different runs of the same script produce different hashes.
To Reproduce
It seems, the hash magic method is defined in a way that is not stable for different dictionary input orders:
Expected behavior
I think hash should be the same if dict data is the same, regardless of input order.
Not sure actually if this behavior is expected by the project authors, but it was unexpected to me.
Additional context
The solution I'm using now is:
The text was updated successfully, but these errors were encountered: