quantumlib / OpenFermion

The electronic structure package for quantum computers.
Apache License 2.0
1.54k stars 378 forks source link

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

Open kevinsung opened 4 years ago

kevinsung commented 4 years ago

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:

kevinsung commented 4 years ago

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).

mpharrigan commented 4 years ago

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