qiskit-algorithms icon indicating copy to clipboard operation
qiskit-algorithms copied to clipboard

[from qiskit] Use dataclass for AlgorithmResult

Open ElePT opened this issue 1 year ago • 2 comments

What should we add?

Now that the Python 3.6 support is dropped we can use dataclasses in Qiskit. Since our AlgorithmResult was essentially a dictionary replacement we implemented ourselves, should we switch to simply using dataclass as an algorithm result?

That would have advantages like

  • much less overhead in writing algorithm results since no getters/setters are required (the docs can go into the class docstring)
  • access to dataclass features such as easy conversion to dicts or easily creating immutable results

ElePT avatar Aug 22 '23 09:08 ElePT