Replace "... is SR" by isinstance(..., sage.rings.abc.SymbolicRing) to handle symbolic subrings
Closed this issue · 26 comments
There are a number of tests ... is SR in the Sage library, as found by git grep 'is SR' src/sage/
These tests ignore symbolic subrings, as constructed by SR.subring(...).
All or most of these uses should be changed to isinstance(..., sage.rings.abc.SymbolicRing) or isinstance(..., sage.symbolic.ring.SymbolicRing) (if the module already imports other things from sage.symbolic)
In addition to handling the case of subrings, this will help with modularization (#32601).
We leave a few uses of is SR to follow-up tickets #31988, #31999.
CC: @dkrenn @egourgoulhon @orlitzky
Component: symbolics
Author: Matthias Koeppe
Branch/Commit: ff83c4c
Reviewer: Michael Orlitzky
Issue created by migration from https://trac.sagemath.org/ticket/32724
Author: Matthias Koeppe, ...
Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:
da82ac5 | src/sage/rings/polynomial/polynomial_element.pyx: Use isinstance(..., sage.rings.abc.SymbolicRing) instead of ... is SR |
3c821bd | sage.functions.other._eval_floor_ceil: Handle elements of symbolic subrings like elements of SR |
Branch pushed to git repo; I updated commit sha1. New commits:
f1c9258 | src/sage/combinat/q_analogues.py: Handle symbolic subrings like SR |
Branch pushed to git repo; I updated commit sha1. New commits:
76e0962 | [Diff]ScalarFieldAlgebra._coerce_map_from_: Also coerce from subrings of SR |
Description changed:
---
+++
@@ -2,7 +2,7 @@
These tests ignore symbolic subrings, as constructed by `SR.subring(...)`.
-All or most of these uses should be changed to `isinstance(..., sage.rings.abc.SymbolicRing)`.
+All or most of these uses should be changed to `isinstance(..., sage.rings.abc.SymbolicRing)` or `isinstance(..., sage.symbolic.ring.SymbolicRing)` (if the module already imports other things from `sage.symbolic`)
In addition to handling the case of subrings, this will help with modularization (#32601).
Branch pushed to git repo; I updated commit sha1. New commits:
038eb9f | src/sage/symbolic/pynac_impl.pxi (py_is_integer, py_is_exact): Handle symbolic subrings like SR |
Branch pushed to git repo; I updated commit sha1. New commits:
ff83c4c | sage.repl.ipython_kernel (widget_from_tuple, slider): Handle symbolic subrings like SR |
Changed author from Matthias Koeppe, ... to Matthias Koeppe
Description changed:
---
+++
@@ -6,3 +6,4 @@
In addition to handling the case of subrings, this will help with modularization (#32601).
+We leave a few uses of `is SR` to follow-up tickets #31988, #31999.Now that we have a passing patchbot, this LGTM. I think "the symbolic ring (or a symbolic subring)" is awkward to repeat so many times and would be better phrased "a symbolic ring," but it's not important.
Reviewer: Michael Orlitzky
Thank you!
I used this phrasing because I didn't want to think about the status of callable symbolic rings in this ticket.