I've seen handrolled __hash__ methods in quite a few places: They
usually take individual hashes of the data defining the object and
combine them in some arbitrary-looking way.

Two examples I came across recently:
  
https://github.com/sagemath/sage/blob/9.4/src/sage/schemes/elliptic_curves/ell_curve_isogeny.py#L1216
  
https://github.com/sagemath/sage/blob/9.4/src/sage/algebras/quatalg/quaternion_algebra_element.pyx#L219

Q: Is there a good reason things done like this, rather than just
calling hash() on a tuple containing the data of the object?

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-devel/20211021111943.3944c74f%40l.

Reply via email to