Skip to content

Commit e4710a2

Browse files
committed
less use of ParentWithGens
1 parent 1be0a58 commit e4710a2

File tree

5 files changed

+9
-15
lines changed

5 files changed

+9
-15
lines changed

src/sage/rings/fraction_field_element.pyx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -348,9 +348,9 @@ cdef class FractionFieldElement(FieldElement):
348348
This function hashes in a special way to ensure that generators of
349349
a ring `R` and generators of a fraction field of `R` have the same
350350
hash. This enables them to be used as keys interchangeably in a
351-
dictionary (since ``==`` will claim them equal). This is particularly
352-
useful for methods like ``subs`` on ``ParentWithGens`` if you are
353-
passing a dictionary of substitutions.
351+
dictionary (since ``==`` will claim them equal).
352+
353+
This is useful for substitution using dicts.
354354
355355
EXAMPLES::
356356

src/sage/rings/polynomial/multi_polynomial_ring_base.pyx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,14 +90,11 @@ cdef class MPolynomialRing_base(CommutativeRing):
9090
self._term_order = order
9191
self._has_singular = False # cannot convert to Singular by default
9292
self._magma_cache = {}
93-
# Ring.__init__ already does assign the names.
94-
# It would be a mistake to call ParentWithGens.__init__
95-
# as well, assigning the names twice.
96-
# ParentWithGens.__init__(self, base_ring, names)
9793
if base_ring.is_zero():
9894
category = categories.rings.Rings().Finite()
9995
else:
10096
category = polynomial_default_category(base_ring.category(), n)
97+
# Ring.__init__ assigns the names.
10198
Ring.__init__(self, base_ring, names, category=category)
10299
from sage.combinat.integer_vector import IntegerVectors
103100
self._indices = IntegerVectors(self._ngens)

src/sage/rings/quotient_ring.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ def is_QuotientRing(x):
383383

384384

385385
@richcmp_method
386-
class QuotientRing_nc(ring.Ring, sage.structure.parent_gens.ParentWithGens):
386+
class QuotientRing_nc(ring.Ring):
387387
"""
388388
The quotient ring of `R` by a twosided ideal `I`.
389389
@@ -495,8 +495,7 @@ def __init__(self, R, I, names, category=None):
495495
raise TypeError("The second argument must be an ideal of the given ring, but %s is not" % I)
496496
self.__R = R
497497
self.__I = I
498-
#sage.structure.parent_gens.ParentWithGens.__init__(self, R.base_ring(), names)
499-
##
498+
500499
# Unfortunately, computing the join of categories, which is done in
501500
# check_default_category, is very expensive.
502501
# However, we don't just want to use the given category without mixing in

src/sage/rings/ring.pyx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -253,8 +253,6 @@ cdef class Ring(ParentWithGens):
253253
# yield an infinite recursion. But when we call it from here, it works.
254254
# This is done in order to ensure that __init_extra__ is called.
255255
#
256-
# ParentWithGens.__init__(self, base, names=names, normalize=normalize)
257-
#
258256
# This is a low-level class. For performance, we trust that the category
259257
# is fine, if it is provided. If it isn't, we use the category of rings.
260258
if category is None:

src/sage/structure/element.pyx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -817,9 +817,9 @@ cdef class Element(SageObject):
817817
ngens = parent.ngens()
818818
except (AttributeError, NotImplementedError, TypeError):
819819
return self
820-
variables=[]
821-
# use "gen" instead of "gens" as a ParentWithGens is not
822-
# required to have the latter
820+
variables = []
821+
822+
# using gen instead of gens
823823
for i in range(ngens):
824824
gen = parent.gen(i)
825825
if str(gen) in kwds:

0 commit comments

Comments
 (0)