Skip to content

Commit 35f10c5

Browse files
author
Release Manager
committed
gh-40097: using _an_element_ in combinat And removing the cache as `an_element` is cached ### 📝 Checklist - [x] The title is concise and informative. - [x] The description explains in detail what this PR is about. URL: #40097 Reported by: Frédéric Chapoton Reviewer(s): Edgar Costa
2 parents 366fb98 + f4acddf commit 35f10c5

17 files changed

+24
-32
lines changed

src/sage/combinat/chas/wqsym.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737
# https://www.gnu.org/licenses/
3838
# ****************************************************************************
3939

40-
from sage.misc.cachefunc import cached_method
4140
from sage.misc.bindable_class import BindableClass
4241
from sage.structure.parent import Parent
4342
from sage.structure.unique_representation import UniqueRepresentation
@@ -238,8 +237,7 @@ def coerce_base_ring(self, x):
238237
return self._coerce_map_via([target], R)
239238
return super()._coerce_map_from_(R)
240239

241-
@cached_method
242-
def an_element(self):
240+
def _an_element_(self):
243241
"""
244242
Return an element of ``self``.
245243

src/sage/combinat/composition_tableau.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -732,7 +732,7 @@ def _repr_(self):
732732
"""
733733
return "Composition tableaux of shape %s and maximum entry %s" % (str(self.shape), str(self.max_entry))
734734

735-
def an_element(self):
735+
def _an_element_(self):
736736
r"""
737737
Return a particular element of :class:`CompositionTableaux_shape`.
738738

src/sage/combinat/debruijn_sequence.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ class DeBruijnSequences(UniqueRepresentation, Parent):
300300
return ("De Bruijn sequences with arity %s and substring length %s"
301301
% (self.k, self.n))
302302

303-
def an_element(self):
303+
def _an_element_(self):
304304
"""
305305
Return the lexicographically smallest De Bruijn sequence with the given
306306
parameters.

src/sage/combinat/fqsym.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,7 @@ def G_to_G_on_basis(t):
165165

166166
return super()._coerce_map_from_(R)
167167

168-
@cached_method
169-
def an_element(self):
168+
def _an_element_(self):
170169
"""
171170
Return an element of ``self``.
172171

src/sage/combinat/free_dendriform_algebra.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -315,8 +315,7 @@ def degree_on_basis(self, t):
315315
"""
316316
return t.node_number()
317317

318-
@cached_method
319-
def an_element(self):
318+
def _an_element_(self):
320319
"""
321320
Return an element of ``self``.
322321

src/sage/combinat/free_prelie_algebra.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -375,8 +375,7 @@ def degree_on_basis(self, t):
375375
"""
376376
return t.node_number()
377377

378-
@cached_method
379-
def an_element(self):
378+
def _an_element_(self):
380379
"""
381380
Return an element of ``self``.
382381

src/sage/combinat/grossman_larson_algebras.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
from sage.combinat.rooted_tree import (RootedTrees, RootedTree,
2323
LabelledRootedTrees,
2424
LabelledRootedTree)
25-
from sage.misc.cachefunc import cached_method
2625
from sage.categories.rings import Rings
2726
from sage.sets.family import Family
2827
from sage.rings.integer_ring import ZZ
@@ -362,8 +361,7 @@ def degree_on_basis(self, t):
362361
"""
363362
return t.node_number() - 1
364363

365-
@cached_method
366-
def an_element(self):
364+
def _an_element_(self):
367365
"""
368366
Return an element of ``self``.
369367

src/sage/combinat/hillman_grassl.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,7 @@ def _repr_(self):
460460

461461
Element = WeakReversePlanePartition
462462

463-
def an_element(self):
463+
def _an_element_(self):
464464
r"""
465465
Return a particular element of the class.
466466

src/sage/combinat/integer_vectors_mod_permgroup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1122,11 +1122,11 @@ def retract(self, elt):
11221122
intarray = self.element_class(self, elt, check=False)
11231123
return self.element_class(self, canonical_representative_of_orbit_of(self._sgs, intarray), check=False)
11241124

1125-
def an_element(self):
1125+
def _an_element_(self):
11261126
r"""
11271127
Return an element of ``self``.
11281128
1129-
Raises an :exc:`EmptySetError` when ``self`` is empty.
1129+
This raises an :exc:`EmptySetError` when ``self`` is empty.
11301130
11311131
EXAMPLES::
11321132

src/sage/combinat/k_tableau.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3928,7 +3928,7 @@ def _repr_( self ):
39283928

39293929
options = Tableaux.options
39303930

3931-
def an_element(self):
3931+
def _an_element_(self):
39323932
r"""
39333933
Return the first generated element of the class of ``StrongTableaux``.
39343934

0 commit comments

Comments
 (0)