Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
Trac #30266: hash compatibility check wrt #30116
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Jung committed Aug 2, 2020
1 parent 055d226 commit 8ca8b75
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/sage/manifolds/scalarfield.py
Original file line number Diff line number Diff line change
Expand Up @@ -3483,8 +3483,10 @@ def set_immutable(self):
sage: X.<x,y> = M.chart()
sage: U = M.open_subset('U', coord_def={X: x^2+y^2<1})
sage: f = M.scalar_field(x^2, name='f')
sage: fU = f.restrict(U)
sage: f.set_immutable()
sage: f.is_immutable()
True
sage: fU = f.restrict(U)
sage: fU.is_immutable()
True
Expand All @@ -3502,16 +3504,18 @@ def __hash__(self):
sage: M = Manifold(2, 'M')
sage: X.<x,y> = M.chart()
sage: U = M.open_subset('U', coord_def={X: x^2+y^2<1})
sage: f = M.scalar_field(x^2, name='f')
sage: fU = f.restrict(U)
sage: f.set_immutable()
sage: g = M.scalar_field(x^2, name='g')
sage: g.set_immutable()
sage: fU.is_immutable()
True
Check whether equality implies equality of hash::
Check whether equality on common domain implies equality of hash::
sage: f == g
sage: f == fU
True
sage: hash(f) == hash(g)
sage: hash(f) == hash(fU)
True
Let us check that ``f`` can be used as a dictionary key::
Expand Down

0 comments on commit 8ca8b75

Please sign in to comment.