![](/img/trans.png)
[英]Preserve anchor names when dumping class with ruamel.yaml and filtering through __getstate__ and __setstate__
我有設置為使用 ruamel.yaml 0.17.21 yaml_object裝飾器加載/轉儲的類。 出於某種原因,我不希望將我的 class 中的更改保存到 yaml,除非用戶特別要求。 為此,我使用__getstate__和__setstate__方法來緩存 initial_state 並且如果 ...