Skip to content

Commit

Permalink
fix hash of PermutationGroup_generic
Browse files Browse the repository at this point in the history
  • Loading branch information
mantepse committed Oct 28, 2024
1 parent 1b3f398 commit 128de95
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/sage/groups/perm_gps/permgroup.py
Original file line number Diff line number Diff line change
Expand Up @@ -762,6 +762,22 @@ def _magma_init_(self, magma):
g = ', '.join([g._gap_cycle_string() for g in self.gens()])
return 'PermutationGroup<%s | %s>' % (self.degree(), g)

def __hash__(self):
r"""
Return a hash value for ``self``.
TESTS::
sage: G = PermutationGroup([(1,2,3), (1,3)])
sage: G == SymmetricGroup(3)
True
sage: G.gens() == SymmetricGroup(3).gens()
False
sage: G in set([SymmetricGroup(3)])
True
"""
return hash(self.cardinality())

def __richcmp__(self, right, op):
"""
Compare ``self`` and ``right``.
Expand Down

0 comments on commit 128de95

Please sign in to comment.