Hello everyone,
It is my first post and I hope it is the right place to send my question. First I would like to thank all the developers who created this great library. We use it in my company but we encountered a very strange behavior. I wanted to do a PR to correct it but the tests show that this may be voluntary behavior.
The problem : even with "evaluate=False" argument, Mul and Add remove identity elements from its arguments. We can see this behavior in tests :
def test_suppressed_evaluation():
a = Add(0, 3, 2, evaluate=False)
b = Mul(1, 3, 2, evaluate=False)
c = Pow(3, 2, evaluate=False)
assert a != 6
assert a.func is Add
assert a.args == (3, 2)
assert b != 6
assert b.func is Mul
assert b.args == (3, 2)
assert c != 9
assert c.func is Pow
assert c.args == (3, 2)
Removing arguments is already a kind of evaluation. For me, we should have :
def test_suppressed_evaluation():
a = Add(0, 3, 2, evaluate=False)
b = Mul(1, 3, 2, evaluate=False)
# ...
assert a.args == (0, 3, 2)
# ...
assert b.args == (1, 3, 2)
# ...
and do not remove any arguments.
I prefer to ask the question here before because the presence of the tests can make believe that this behavior is voluntary.
Christophe Gabard