Skip to content

py3: implement __hash__ method in ContinuousMap #25502

@egourgoulhon

Description

@egourgoulhon

ContinuousMap defines its own __eq__ method, while inheritating from Morphism.__hash__. Now, as pointed out in #24551, Python3 breaks the inheritance of __hash__ when __eq__ is redefined. This ticket fixes this by implementing ContinousMap.__hash__. Moreover, contrary to Morphism.__hash__, the new method does not rely on repr() and guarantees that two continous maps that compare equal have the same hash.

Note that there is a proposal at #25393 to remove Morphism.__hash__.

ContinousMap (more precisely the derived class DiffMap) needs to be hashable because DiffMap objects serve as keys in the dictionary of vector field modules on a manifold, a module of vector fields on a differentiable manifold being essentially defined by a differentiable map (with the important special case of the identity map; see here for details).

CC: @tscrim @embray @fchapoton

Component: geometry

Keywords: topological manifold

Author: Eric Gourgoulhon

Branch/Commit: 83dcbb1

Reviewer: Frédéric Chapoton

Issue created by migration from https://trac.sagemath.org/ticket/25502

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions