I think that x.__bool__ should return True only if x is *known* to be zero.

I have three docstrings that support this view:

rings/real_mpfi.pyx\03905:    def __bool__(self):
rings/real_mpfi.pyx\03906-        """
rings/real_mpfi.pyx\03907-        Return ``True`` if ``self`` is not known 
to be exactly zero.
rings/real_mpfi.pyx\03908-
--
rings/complex_interval.pyx\01495:    def __bool__(self):
rings/complex_interval.pyx\01496-        """
rings/complex_interval.pyx\01497-        Return ``True`` if ``self`` is not 
known to be exactly zero.
rings/complex_interval.pyx\01498-
--
symbolic/expression.pyx\03310:    def __bool__(self):
symbolic/expression.pyx\03311-        """
symbolic/expression.pyx\03312-        Return True unless this symbolic 
expression can be shown by Sage
symbolic/expression.pyx\03313-        to be zero.  Note that deciding if an 
expression is zero is

and I have not found a docstring contradicting this point of view.  
However, the behaviour of (fixed precision) power series is different:

sage: R.<t> = QQ[[]]
sage: f = t.add_bigoh(5) - t
sage: f
O(t^5)
sage: not f
True

I think that this is a bug.

One implication is, as noticed by Chris Wuthrich, that the product "x * y" 
is not necessarily zero, even if "not x" gives True.

Before trying to create a branch, I'd like to hear other opinions.

Martin

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-devel/5ad675ea-1cf1-4ea5-a39d-40eb567ff2e9n%40googlegroups.com.

Reply via email to