-
-
Notifications
You must be signed in to change notification settings - Fork 702
Description
As far as I can tell there is no code using the ability to hash Morphisms, and having this in the base class is misleading since there are subclasses which are not immutable and should not be hashable anyways. It would be better to implement __hash__ on an as-needed basis for those classes that can guarantee immutability.
Original description
ContinuousMap is impacted by #24551 in that it defines an __eq__, so its default hash is not inherited from its base class, Morphism (which does define __hash__).
This is one of the classes impacted by the issue raised in this comment.
I'm not sure what the best solution is. Right now I feel like it's somewhat ill-defined, because it's possible to have two ContinuousMaps that compare as equal, but have different hashes. That's not necessarily wrong, but it isn't obviously right either. If x == y, then hash(x) == hash(y) for a correct implementation. Technically I believe you can get away with the inverse--having hash(x) == hash(y) but x != y--but it is advisable for performance to avoid this.
Component: geometry
Author: Erik Bray
Branch/Commit: u/embray/misc/ticket-25393 @ 1a99057
Issue created by migration from https://trac.sagemath.org/ticket/25393