pyzx icon indicating copy to clipboard operation
pyzx copied to clipboard

proposed Graph API changes

Open akissinger opened this issue 4 years ago • 1 comments

Two proposed changes to the API. (We can keep the old methods as aliases, but deprecate them if you like.)

  1. I've recently overloaded * to compose diagrams in fomula-order. I.e. g * h means g AFTER h. I suggest keeping an operator for composing in diagram order, but changing it from from + to >>.
  2. change auto_detect_inputs to auto_detect_io. I find current name confusing, because it does both.

akissinger avatar Oct 21 '20 10:10 akissinger

  1. There is also a + operator for Circuits, where it does exactly what you would expect in Python: append the lists of gates to one another. So we could remove + for Graphs, but then there is an additional syntax thing you have to remember, or we could remove + for Circuits and replace it by >>, which I find slightly less natural (although it does have precedence in C++).
  2. I agree that inputs is a bit confusing, but I don't really like auto_detect_io, what about auto_detect_boundaries?

jvdwetering avatar Oct 21 '20 10:10 jvdwetering