Skip to content

Commit 05fec04

Browse files
author
Release Manager
committed
gh-38346: Updated `__repr__()` to `_repr_()` in ideals classes <!-- ^ Please provide a concise and informative title. --> <!-- ^ Don't put issue numbers in the title, do this in the PR description below. --> <!-- ^ For example, instead of "Fixes #12345" use "Introduce new method to calculate 1 + 2". --> <!-- v Describe your changes below in detail. --> <!-- v Why is this change required? What problem does it solve? --> <!-- v If this PR resolves an open issue, please link to it here. For example, "Fixes #12345". --> This PR aims at updating `__repr__()` method to `_repr_()`, in order to enable renaming and ensure consistency across various SageMath classes. @tscrim ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. --> - [x] The title is concise and informative. - [x] The description explains in detail what this PR is about. - [x] I have linked a relevant issue or discussion. - [x] I have created tests covering the changes. - [x] I have updated the documentation and checked the documentation preview. ### ⌛ Dependencies <!-- List all open PRs that this PR logically depends on. For example, --> <!-- - #12345: short description why this is a dependency --> <!-- - #34567: ... --> URL: #38346 Reported by: 25shriya Reviewer(s): Travis Scrimshaw
2 parents 78379ac + 5674225 commit 05fec04

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/sage/rings/ideal.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ def _repr_short(self):
320320
return '\n(\n %s\n)\n' % (',\n\n '.join(L))
321321
return '(%s)' % (', '.join(L))
322322

323-
def __repr__(self):
323+
def _repr_(self):
324324
"""
325325
Return a string representation of ``self``.
326326
@@ -1270,7 +1270,7 @@ class Ideal_principal(Ideal_generic):
12701270
#def __init__(self, ring, gen):
12711271
# Ideal_generic.__init__(self, ring, [gen])
12721272

1273-
def __repr__(self):
1273+
def _repr_(self):
12741274
"""
12751275
Return a string representation of ``self``.
12761276
@@ -1700,7 +1700,7 @@ class Ideal_fractional(Ideal_generic):
17001700
17011701
See :func:`Ideal()`.
17021702
"""
1703-
def __repr__(self):
1703+
def _repr_(self):
17041704
"""
17051705
Return a string representation of ``self``.
17061706

src/sage/rings/number_field/number_field_ideal.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,7 @@ def __elements_from_hnf(self, hnf):
427427
K = self.number_field()
428428
return [K(x, check=False) for x in K.pari_zk() * hnf]
429429

430-
def __repr__(self):
430+
def _repr_(self):
431431
"""
432432
Return the string representation of this number field ideal.
433433
@@ -1862,7 +1862,7 @@ def __init__(self, field, gens, coerce=True):
18621862
else:
18631863
raise ValueError("gens must have a nonzero element (zero ideal is not a fractional ideal)")
18641864

1865-
def __repr__(self):
1865+
def _repr_(self):
18661866
"""
18671867
Return the string representation of this number field fractional ideal.
18681868

0 commit comments

Comments
 (0)