From 2feea753a49386d7d9978e509dfdf67e6449269a Mon Sep 17 00:00:00 2001 From: David Yonge-Mallo Date: Sat, 6 Apr 2024 10:14:36 +0200 Subject: [PATCH] Add helpful suggestion to `parse_gate` when called with non-basic gate. This also makes the error message consistent with the one in `phase_block_optimize`. See #196 for context. --- pyzx/optimize.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyzx/optimize.py b/pyzx/optimize.py index f047111c..44c36acd 100644 --- a/pyzx/optimize.py +++ b/pyzx/optimize.py @@ -512,9 +512,9 @@ def parse_gate(self, g: Gate) -> None: else: # Only the control has a hadamard gate in front of it self.add_hadamard(c) self.add_cnot(g) - + else: - raise TypeError("Unknown gate {}".format(str(g))) + raise TypeError("Unknown gate {}. Maybe simplify the gates with circuit.to_basic_gates()?".format(str(g)))