-1
I like bool(x>0) to be False by default if the answer is not known.
mhansen raised this great point that we rely so much on things like :
if (condition on x):
do something
that it would be cumbersome to surround this statement with a try,catch block.
I'm only opposing this because it is unpythonic but I don't see any
reason not to define methods that have the same functionality for
SymbolicEquation but *can* raise an exception when appropriate.
didier
The reason why I eventually decided that throwing an exception was
unpythonic was that I could not find a single case of current python
code which did that. Actually, the one reference I did find was a
bugfix to a project (I think SQLAlchemy), in which they changed
__nonzero__ to not raise an exception since it was inconsistent with
other behavior.
That, and the fact that Python by default returns True for objects
instead of raising exceptions, tells me that raising exceptions would
also raise an exceptional number of eyebrows and probably voices too.
I think we ought to have a different function for testing true/false and
would return a third value (None? an exception?) if the value was not known.
Jason
I vote +1 to Carl's proposal.
William
Dear sagemath-developers,
the issue with unexpected behaviour of bool(SymbolicExpression)
seems still unresolved (at least in versions <= 5.8);
see http://ask.sagemath.org/question/2853/testing-inequalities-in-sage
I vote for returning an exception in case the algorithm cannot decide if the expression is True or False;
alternatively ( in my opinion ) bool() should NOT be applicable to symbolic expressions for which a natural answer is at least tri-state, even if it breaks a lot of code.
Best,
Jack