sagemath/sage

sage.structure.element: Add abc Expression; deprecate is_Expression etc.

Closed this issue · 34 comments

(part of meta-ticket #32414)

in sage.structure.element, we add a class Expression

  • the existing class sage.symbolic.expression.Expression will be its only subclass
  • deprecate is_Expression, replace uses by isinstance(x, sage.structure.element.Expression)

Follow-up in #32665: Also deprecate is_SymbolicEquation, is_CallableSymbolicExpression, is_SymbolicVariable; replace uses by isinstance(x, Expression) and a method call (may need a new method is_callable)

Depends on #32599

CC: @DaveWitteMorris @tscrim @mjungmath

Component: refactoring

Author: Matthias Koeppe

Branch/Commit: ee7640c

Reviewer: Travis Scrimshaw

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

New commits:

37ee682sage.structure.element.Expression: New abc for sage.symbolic.expression.Expression

Description changed:

--- 
+++ 
@@ -1,6 +1,6 @@
 (part of meta-ticket #32414)
 
 in `sage.structure.element`, we add a class `Expression`
-- the existing class `sage.symbolic.expression.Expression` will be renamed to `Expression_pynac` and be its only subclass
+- the existing class `sage.symbolic.expression.Expression` will be its only subclass
 - deprecate `is_Expression`, `is_SymbolicEquation`, `is_CallableSymbolicExpression`, `is_SymbolicVariable`; replace uses by `isinstance(x, Expression)` and a method call (may need a new method `is_callable`)
 

Commit: 37ee682

Changed commit from 37ee682 to 08bf900

Branch pushed to git repo; I updated commit sha1. New commits:

56d1c36git grep -l -E 'is_Expression' | xargs sed -E -i.bak 's/sage[.]symbolic.*import is_Expression *$/sage.structure.element import Expression/;s/is_Expression[(]([^)]*)[)]/isinstance(\1, Expression)/g;'
08bf900is_Expression: Undo automatic edit of the definition; deprecate

Description changed:

--- 
+++ 
@@ -2,5 +2,7 @@
 
 in `sage.structure.element`, we add a class `Expression`
 - the existing class `sage.symbolic.expression.Expression` will be its only subclass
-- deprecate `is_Expression`, `is_SymbolicEquation`, `is_CallableSymbolicExpression`, `is_SymbolicVariable`; replace uses by `isinstance(x, Expression)` and a method call (may need a new method `is_callable`)
+- deprecate `is_Expression`
 
+Follow-up: Also deprecate `is_SymbolicEquation`, `is_CallableSymbolicExpression`, `is_SymbolicVariable`; replace uses by `isinstance(x, Expression)` and a method call (may need a new method `is_callable`)
+

Author: Matthias Koeppe

comment:4

setting to needs_review so that the patchbot runs

Branch pushed to git repo; I updated commit sha1. New commits:

4e5fe35src/sage/symbolic/expression.pxd: Undo automatic edit

Changed commit from 08bf900 to 4e5fe35

Branch pushed to git repo; I updated commit sha1. New commits:

e14259bsrc/sage/ext/fast_callable.pyx: Fix up clash of sage.ext.fast_callable.Expression and sage.structure.element.Expression

Changed commit from 4e5fe35 to e14259b

Branch pushed to git repo; I updated commit sha1. New commits:

daed11esrc/sage/symbolic/function.pyx: Update imports

Changed commit from e14259b to daed11e

Changed commit from daed11e to c52251b

Branch pushed to git repo; I updated commit sha1. New commits:

c52251bsrc/sage/symbolic/ring.pyx: Update imports

Description changed:

--- 
+++ 
@@ -2,7 +2,7 @@
 
 in `sage.structure.element`, we add a class `Expression`
 - the existing class `sage.symbolic.expression.Expression` will be its only subclass
-- deprecate `is_Expression`
+- deprecate `is_Expression`, replace uses by `isinstance(x, sage.structure.element.Expression)`
 
 Follow-up: Also deprecate `is_SymbolicEquation`, `is_CallableSymbolicExpression`, `is_SymbolicVariable`; replace uses by `isinstance(x, Expression)` and a method call (may need a new method `is_callable`)
 

Changed commit from c52251b to 2a81e0f

Branch pushed to git repo; I updated commit sha1. New commits:

0f30530src/sage/misc/sageinspect.py: Fix up a doctest on the source code of src/sage/symbolic/expression.pyx
2a81e0fsrc/sage/symbolic/expression.pyx: Fix markup of doctest output

Branch pushed to git repo; I updated commit sha1. New commits:

88886eesrc/sage/symbolic/expression.pyx: Fix doctest output

Changed commit from 2a81e0f to 88886ee

Branch pushed to git repo; I updated commit sha1. New commits:

cf9b75asrc/sage/symbolic/relation.py: Remove unused import; use sage.structure.element.Expression for isinstance

Changed commit from 88886ee to cf9b75a

comment:14

LGTM.

Reviewer: Travis Scrimshaw

comment:15

Thank you!

Description changed:

--- 
+++ 
@@ -4,5 +4,5 @@
 - the existing class `sage.symbolic.expression.Expression` will be its only subclass
 - deprecate `is_Expression`, replace uses by `isinstance(x, sage.structure.element.Expression)`
 
-Follow-up: Also deprecate `is_SymbolicEquation`, `is_CallableSymbolicExpression`, `is_SymbolicVariable`; replace uses by `isinstance(x, Expression)` and a method call (may need a new method `is_callable`)
+Follow-up in #32665: Also deprecate `is_SymbolicEquation`, `is_CallableSymbolicExpression`, `is_SymbolicVariable`; replace uses by `isinstance(x, Expression)` and a method call (may need a new method `is_callable`)
 

Branch pushed to git repo; I updated commit sha1 and set ticket back to needs_review. New commits:

ec8400bMerge tag '9.5.beta3' into t/32638/sage_structure_element__add_abc_expression__deprecate_is_expression_etc_

Changed commit from cf9b75a to ec8400b

Dependencies: #32599

Branch pushed to git repo; I updated commit sha1 and set ticket back to needs_review. New commits:

8e27fdcsrc/sage/structure/sequence.py: Do not fail if polynomial rings cannot be imported
b43a50csrc/sage/sets/condition_set.py: Do not fail if sage.symbolic cannot be imported
73aabd2src/sage/sets/condition_set.py: Fix up import
ee7640cMerge #32599

Changed commit from ec8400b to ee7640c