is_MPolynomial

20 views
Skip to first unread message

Luis Finotti

unread,
Jun 27, 2023, 7:54:49 AM6/27/23
to sage-support
Hello,

I am getting warnings that is_MPolynomial is deprecated.  The error suggests to use

isinstance(x, sage.structure.element.MPolynomial)

But this gives an error:

AttributeError: module 'sage.structure.element' has no attribute 'MPolynomial'

Looking at the referred github report (https://github.com/sagemath/sage/issues/32709) it is suggested to use isinstance(x, MPolynomial),
 which also fails with

NameError: name 'MPolynomial' is not defined

So, what is the proper way now?

Dima Pasechnik

unread,
Jun 27, 2023, 8:41:00 AM6/27/23
to sage-s...@googlegroups.com
On Tue, Jun 27, 2023 at 12:54 PM Luis Finotti <luis.f...@gmail.com> wrote:
>
> Hello,
>
> I am getting warnings that is_MPolynomial is deprecated. The error suggests to use
>
> isinstance(x, sage.structure.element.MPolynomial)
>
> But this gives an error:
>
> AttributeError: module 'sage.structure.element' has no attribute 'MPolynomial'
probably a typo in deprecation message. You can ask Sage:

sage: import_statements("MPolynomial")
from sage.rings.polynomial.multi_polynomial import MPolynomial


>
> Looking at the referred github report (https://github.com/sagemath/sage/issues/32709) it is suggested to use isinstance(x, MPolynomial),
> which also fails with
>
> NameError: name 'MPolynomial' is not defined
>
> So, what is the proper way now?
>
> --
> You received this message because you are subscribed to the Google Groups "sage-support" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to sage-support...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/sage-support/f1d6b09d-818b-4a1f-a5b1-9641befa5ce2n%40googlegroups.com.

Dima Pasechnik

unread,
Jun 27, 2023, 9:12:41 AM6/27/23
to sage-s...@googlegroups.com

Luis Finotti

unread,
Jun 27, 2023, 12:46:07 PM6/27/23
to sage-support
Thanks!  It works now.
Reply all
Reply to author
Forward
0 new messages