Skip to content

Add ETuple option to polynomial degrees#42448

Open
Ap4sh wants to merge 1 commit into
sagemath:developfrom
Ap4sh:polynomial-degrees-etuple-option
Open

Add ETuple option to polynomial degrees#42448
Ap4sh wants to merge 1 commit into
sagemath:developfrom
Ap4sh:polynomial-degrees-etuple-option

Conversation

@Ap4sh

@Ap4sh Ap4sh commented Jun 28, 2026

Copy link
Copy Markdown
Contributor

This adds an as_ETuples keyword to degrees() for the two finite multivariate polynomial backends that currently expose different return types

The defaults are intentionally unchanged:

  • MPolynomial_polydict.degrees() still returns an ETuple
  • MPolynomial_libsingular.degrees() still returns a tuple

That keeps existing callers compatible while giving callers an explicit way to request either representation, similar to exponents(as_ETuples=...)

Part of #38632

Checks:

  • ./sage -b
  • ./sage -t --long src/sage/rings/polynomial/multi_polynomial_element.py src/sage/rings/polynomial/multi_polynomial_libsingular.pyx
  • ./sage -tox -e relint -- src/sage/rings/polynomial/multi_polynomial_element.py src/sage/rings/polynomial/multi_polynomial_libsingular.pyx
  • ./sage -tox -e rst -- src/sage/rings/polynomial/multi_polynomial_element.py src/sage/rings/polynomial/multi_polynomial_libsingular.pyx
  • manual type checks for the defaults, as_ETuples=True, as_ETuples=False, and zero polynomials

📝 Checklist

  • The title is concise and informative
  • The description explains in detail what this PR is about
  • I have linked a relevant issue or discussion
  • I have created tests covering the changes
  • I have updated the documentation and checked the documentation preview

⌛ Dependencies

None

@github-actions

Copy link
Copy Markdown

Documentation preview for this PR (built with commit 37567c3; changes) is ready! 🎉
This preview will update shortly after each push to this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant