diff --git a/src/operators/diagonal_operator.py b/src/operators/diagonal_operator.py index 670e972219734c997d7abb14768da2be957650a8..557878278965838430033e96eb466c0f3e188368 100644 --- a/src/operators/diagonal_operator.py +++ b/src/operators/diagonal_operator.py @@ -94,7 +94,8 @@ class DiagonalOperator(EndomorphicOperator): raise ValueError("spaces and domain must have the same length") for i, j in enumerate(self._spaces): if diagonal.domain[i] != self._domain[j]: - raise ValueError("Mismatch:\n{diagonal.domain[i]}\n{self._domain[j]}") + raise ValueError(f"Mismatch between:\n{diagonal.domain[i]}\n" + f"and:\n{self._domain[j]}") if self._spaces == tuple(range(len(self._domain))): self._spaces = None # shortcut