Skip to content

Commit acdfe74

Browse files
committed
Make Jacobian morphisms hashable
1 parent 94fe540 commit acdfe74

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/sage/schemes/hyperelliptic_curves/jacobian_morphism.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,7 @@ def __init__(self, parent, polys, check=True):
403403
genus = C.genus()
404404
if a.degree() > genus:
405405
polys = cantor_reduction(a, b, f, h, genus)
406-
self.__polys = polys
406+
self.__polys = tuple(polys)
407407

408408
def _printing_polys(self):
409409
r"""
@@ -633,7 +633,7 @@ def __tuple__(self):
633633
sage: tuple(P) # indirect doctest # needs sage.rings.number_field
634634
(x - 1, -a)
635635
"""
636-
return tuple(self.__polys)
636+
return self.__polys
637637

638638
def __getitem__(self, n):
639639
r"""
@@ -662,9 +662,9 @@ def __getitem__(self, n):
662662
sage: P[-1] # indirect doctest
663663
-a
664664
sage: P[:1] # indirect doctest
665-
[x - 1]
665+
(x - 1,)
666666
"""
667-
return list(self.__polys)[n]
667+
return self.__polys[n]
668668

669669
def _richcmp_(self, other, op):
670670
r"""
@@ -724,6 +724,9 @@ def _richcmp_(self, other, op):
724724
# comparing polynomials is well-defined
725725
return richcmp(self.__polys, other.__polys, op)
726726

727+
def __hash__(self):
728+
return hash(self.__polys)
729+
727730
def __bool__(self):
728731
r"""
729732
Return ``True`` if this divisor is not the additive identity element.

0 commit comments

Comments
 (0)