Skip to content

Add ABCs CommutativePolynomial, MPolynomial_libsingular, InfinitePolynomial; deprecate is_Polynomial, is_MPolynomial #32709

@mkoeppe

Description

@mkoeppe

isinstance(x, [M]Polynomial) replaces the use of is_Polynomial, is_MPolynomial (deprecated here).

The new class CommutativePolynomial is an ABC that is a common base of Polynomial, MPolynomial, and InfinitePolynomial. We introduce it here although there is currently no use for isinstance(x, CommutativePolynomial) in the library.

The new class InfinitePolynomial is a common base class of InfinitePolynomial_sparse and InfinitePolynomial_dense. Methods shared between both classes are moved to the new class.

The new class MPolynomial_libsingular is an ABCDEFIT (ABC defined exclusively for isinstance tests) with a unique direct subclass (see Meta-ticket #32414 and https://doc.sagemath.org/html/en/developer/packaging_sage_library.html#module-level-runtime-dependencies for this design pattern). Its purpose is to replace uses of isinstance(x, MPolynomial_libsingular) throughout the library. This eliminates hard run-time dependencies on Singular.

We also make sage.rings.polynomial a namespace package; this is needed because element implementations depend on various libraries.

CC: @dimpase @mezzarobba @videlec @tscrim

Component: refactoring

Author: Matthias Koeppe

Reviewer: Travis Scrimshaw

Issue created by migration from https://trac.sagemath.org/ticket/32709

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions