OmegaConfの主要機能にmergeがある。
このmerge機能、Listに関して「筋は通っているが癖のある振る舞い」をする。
Merge == Reassign
OmegaConfのListに対するmergeは reassign としてのみ機能する。
from omegaconf import OmegaConf conf1 = OmegaConf.create([ {"attrN": 1, "attrS": "hello"}, {"attrN": 2, "attrS": "world"}, ]) conf2 = OmegaConf.create([ {"attrN": 3,}, {"attrN": 4,}, ]) OmegaConf.merge(conf1, conf2) // [{'attrN': 3}, {'attrN': 4}]
このようにlist mergeはappendとして機能しないし、Dictのような要素mixをしてくれない。
これは意図した設計とのこと
As of OmegaConf 2.0, lists merge is always replacing the target list.
Omry Yadan
python - OmegaConf can I influence how lists are merged - Stack Overflow