OpenFermion icon indicating copy to clipboard operation
OpenFermion copied to clipboard

== for SymbolicOperator and other classes should be exact, not approximate, equality

Open kevinsung opened this issue 4 years ago • 2 comments

Using == for exact equality matches its semantics in every other case I can think of. I realize that I actually advocated for changing it, but in hindsight I think that was a big mistake.

Affected classes:

  • SymbolicOperator
  • MajoranaOperator
  • PolynomialTensor

kevinsung avatar Aug 20 '20 17:08 kevinsung

We can either:

  1. Leave __eq__ unimplemented.
  2. Make it mean that the terms dictionaries have the same keys, which are mapped to the exact same values.

I lean towards (2).

kevinsung avatar Aug 22 '20 18:08 kevinsung

Do we have a sense of how == is currently used? How much of an impact to users would it be to remove it? I usually think if something is ambiguous, you should force the user to specify, i.e. (1) leave unimplemented.

In any event, I think this has been the behavior for some time so we should go through a deprecation cycle

mpharrigan avatar Aug 26 '20 14:08 mpharrigan