Skip to content
  • Julian Rüth's avatar
    Introduced _cache_key for sage objects · 7a0f0940
    Julian Rüth authored
    No meaningful hash function can be defined for elements which overwrite the
    operator == like the p-adics do since the contract on __hash__ would be broken:
    elements which compare equal would have different hash values. This would break
    caches and lead to subtle bugs. Still such elements should be cacheable for
    performance. As a workaround, such non-hashable elements can define a
    _cache_key which uniquely identifies them, and so fixes the "broken" ==
    operator.
    7a0f0940