Skip to content

Commit

Permalink
src/sage/combinat/sf/sfa.py: Deprecate is_SymmetricFunction
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthias Koeppe committed Jun 26, 2024
1 parent ab24dac commit 2e14767
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/sage/combinat/sf/classical.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ def _element_constructor_(self, x):
##############
# Dual bases #
##############
elif sfa.is_SymmetricFunction(x) and hasattr(x, 'dual'):
elif isinstance(x, sfa.SymmetricFunctionAlgebra_generic.Element) and hasattr(x, 'dual'):
# Check to see if it is the dual of some other basis
# If it is, try to coerce its corresponding element
# in the other basis
Expand Down
10 changes: 9 additions & 1 deletion src/sage/combinat/sf/sfa.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,12 +304,20 @@ def is_SymmetricFunction(x):
sage: from sage.combinat.sf.sfa import is_SymmetricFunction
sage: s = SymmetricFunctions(QQ).s()
sage: is_SymmetricFunction(2)
doctest:warning...
DeprecationWarning: The function is_SymmetricFunction is deprecated;
use 'isinstance(..., SymmetricFunctionAlgebra_generic.Element)' instead.
See https://github.com/sagemath/sage/issues/38279 for details.
False
sage: is_SymmetricFunction(s(2))
True
sage: is_SymmetricFunction(s([2,1]))
True
"""
from sage.misc.superseded import deprecation
deprecation(38279,
"The function is_SymmetricFunction is deprecated; "
"use 'isinstance(..., SymmetricFunctionAlgebra_generic.Element)' instead.")
return isinstance(x, SymmetricFunctionAlgebra_generic.Element)

#####################################################################
Expand Down Expand Up @@ -3429,7 +3437,7 @@ def plethysm(self, x, include=None, exclude=None):

tHA = HopfAlgebrasWithBasis(R).TensorProducts()
tensorflag = Px in tHA
if not is_SymmetricFunction(x):
if not isinstance(x, SymmetricFunctionAlgebra_generic.Element):
if R.has_coerce_map_from(Px) or x in R:
x = R(x)
Px = R
Expand Down
10 changes: 4 additions & 6 deletions src/sage/rings/lazy_series.py
Original file line number Diff line number Diff line change
Expand Up @@ -6981,9 +6981,8 @@ def functorial_composition(self, *args):
"""
if len(args) != self.parent()._arity:
raise ValueError("arity must be equal to the number of arguments provided")
from sage.combinat.sf.sfa import is_SymmetricFunction
if not all(isinstance(g, LazySymmetricFunction)
or is_SymmetricFunction(g)
from sage.combinat.sf.sfa import SymmetricFunctionAlgebra_generic
if not all(isinstance(g, (LazySymmetricFunction, SymmetricFunctionAlgebra_generic.Element))
or not g for g in args):
raise ValueError("all arguments must be (possibly lazy) symmetric functions")

Expand Down Expand Up @@ -7200,9 +7199,8 @@ def arithmetic_product(self, *args):
"""
if len(args) != self.parent()._arity:
raise ValueError("arity must be equal to the number of arguments provided")
from sage.combinat.sf.sfa import is_SymmetricFunction
if not all(isinstance(g, LazySymmetricFunction)
or is_SymmetricFunction(g)
from sage.combinat.sf.sfa import SymmetricFunctionAlgebra_generic
if not all(isinstance(g, (LazySymmetricFunction, SymmetricFunctionAlgebra_generic.Element))
or not g for g in args):
raise ValueError("all arguments must be (possibly lazy) symmetric functions")

Expand Down

0 comments on commit 2e14767

Please sign in to comment.