Dear Johannes,

Thanks for the report. This is indeed unfortunate. I opened
the following ticket

https://trac.sagemath.org/ticket/31236

Best
Vincent

Le 14/01/2021 à 11:31, Johannes Schwab a écrit :
Dear all,

the current implementation of __hash__ for PermutationGroupElement returns
a hash that not only depends on the given permutation, but also on the
group the permutation lives in.
Thus the "same" permutation (when compared with __eq__) may have different
hash values, which is not in line with the Python documentation (
https://docs.python.org/3.5/reference/datamodel.html#object.__hash__) and
leads to unexpected situations as the following.

sage: G = SymmetricGroup(2)
sage: H = SymmetricGroup(1)
sage: d = {G.one() : "FooBaa"}
sage: H.one() in list(d.keys())
True
sage: H.one() in d
False

Best,
Johannes Schwab


--
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 sage-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-devel/984ee527-1a60-37fa-88d0-c00093436266%40gmail.com.

Reply via email to