diff --git a/src/sage/monoids/free_abelian_monoid.py b/src/sage/monoids/free_abelian_monoid.py index 590a20eaa1a..ee5e8df0257 100644 --- a/src/sage/monoids/free_abelian_monoid.py +++ b/src/sage/monoids/free_abelian_monoid.py @@ -169,6 +169,10 @@ def is_FreeAbelianMonoid(x): sage: from sage.monoids.free_abelian_monoid import is_FreeAbelianMonoid sage: is_FreeAbelianMonoid(5) + doctest:warning... + DeprecationWarning: the function is_FreeAbelianMonoid is deprecated; + use 'isinstance(..., FreeAbelianMonoid_class)' instead + See https://github.com/sagemath/sage/issues/37897 for details. False sage: is_FreeAbelianMonoid(FreeAbelianMonoid(7,'a')) True @@ -177,6 +181,8 @@ def is_FreeAbelianMonoid(x): sage: is_FreeAbelianMonoid(FreeMonoid(0,'')) False """ + from sage.misc.superseded import deprecation + deprecation(37897, "the function is_FreeAbelianMonoid is deprecated; use 'isinstance(..., FreeAbelianMonoid_class)' instead") return isinstance(x, FreeAbelianMonoid_class) diff --git a/src/sage/monoids/free_monoid.py b/src/sage/monoids/free_monoid.py index 88277320a63..3e8ed837cf8 100644 --- a/src/sage/monoids/free_monoid.py +++ b/src/sage/monoids/free_monoid.py @@ -44,6 +44,10 @@ def is_FreeMonoid(x): sage: from sage.monoids.free_monoid import is_FreeMonoid sage: is_FreeMonoid(5) + doctest:warning... + DeprecationWarning: the function is_FreeMonoid is deprecated; + use 'isinstance(..., (FreeMonoid, IndexedFreeMonoid))' instead + See https://github.com/sagemath/sage/issues/37897 for details. False sage: is_FreeMonoid(FreeMonoid(7,'a')) True @@ -56,6 +60,8 @@ def is_FreeMonoid(x): sage: is_FreeMonoid(FreeAbelianMonoid(index_set=ZZ)) False """ + from sage.misc.superseded import deprecation + deprecation(37897, "the function is_FreeMonoid is deprecated; use 'isinstance(..., (FreeMonoid, IndexedFreeMonoid))' instead") if isinstance(x, FreeMonoid): return True from sage.monoids.indexed_free_monoid import IndexedFreeMonoid diff --git a/src/sage/monoids/monoid.py b/src/sage/monoids/monoid.py index 97c0dfa6ad3..c0330ad0eb3 100644 --- a/src/sage/monoids/monoid.py +++ b/src/sage/monoids/monoid.py @@ -14,6 +14,10 @@ def is_Monoid(x) -> bool: sage: from sage.monoids.monoid import is_Monoid sage: is_Monoid(0) + doctest:warning... + DeprecationWarning: the function is_Monoid is deprecated; + use 'isinstance(..., Monoid_class)' instead + See https://github.com/sagemath/sage/issues/37897 for details. False sage: is_Monoid(ZZ) # The technical math meaning of monoid has ....: # no bearing whatsoever on the result: it's @@ -26,6 +30,8 @@ def is_Monoid(x) -> bool: sage: is_Monoid(F) True """ + from sage.misc.superseded import deprecation + deprecation(37897, "the function is_Monoid is deprecated; use 'isinstance(..., Monoid_class)' instead") return isinstance(x, Monoid_class)