Closed qku closed 7 months ago
Add a custom YAML constructor and representer for the built-in type tuple.
tuple
I found this SO post: https://stackoverflow.com/questions/9169025/how-can-i-add-a-python-tuple-to-a-yaml-file-using-pyyaml
Currently, when a tuple is dumped and loaded again, you get a list.
list
from qudi.util.yaml import yaml_dump, yaml_load file = 'test.yml' a = (1, 2, 3) yaml_dump(file, a) a_loaded = yaml_load(file) assert a_loaded.isinstance(tuple)
Rewriting classes such that they can handle both lists and tuples.
This is in the context of the ScanSettings data class in qudi-iqo-modules.
ScanSettings
No response
I suggest to close this. It is easily possible to convert lists to tuples at the point of use.
Feature Description
Add a custom YAML constructor and representer for the built-in type
tuple
.I found this SO post: https://stackoverflow.com/questions/9169025/how-can-i-add-a-python-tuple-to-a-yaml-file-using-pyyaml
Related Problem
Currently, when a
tuple
is dumped and loaded again, you get alist
.Considered Alternatives
Rewriting classes such that they can handle both lists and tuples.
Additional Context
This is in the context of the
ScanSettings
data class in qudi-iqo-modules.Contact Details
No response