Qualtran
Qualtran copied to clipboard
Misclassifying sympy constants as symbolic
If some value is computed through sympy, but is a constant, we still treat it as symbolic. Here is a sample code snippet
import sympy
from qualtran.symbolics import is_symbolic
n = sympy.symbols("n")
c = (2 * n) // n
assert is_symbolic(c)
assert int(c) == 2
print(c.__class__) # <class 'sympy.core.numbers.Integer'>
It would be preferrable to extract constants in a safe way, to enable more decomposition etc.