On Tue, Nov 15, 2016 at 09:27:14AM +0100, Vincent Delecroix wrote:
> On 15 November 2016 at 09:19, Thierry <sage-googlesu...@lma.metelu.net> wrote:
> > On Tue, Nov 15, 2016 at 08:53:43AM +0100, Vincent Delecroix wrote:
> >> Not currently (though we have "Unknown"). The main problem is the
> >> interaction with Python booleans and the operators "or", "and", "not"
> >> (which are *not* logical operators). The Sage "Unknown" is badly
> >> broken for these reasons
> >>
> >> sage: not Unknown   # waiting for Unknown
> >> True
> >> sage: Unknown or False   # waiting for Unknown
> >> False
> >>
> >> So be careful if you start using it!
> >>
> >> If we would use the correct logical operators ~ (for negation), ^ (for
> >> xor) and & (for and) then we might be able to come up with something.
> >> But Sage sort of ignore them.
> >>
> >> This problem has been discussed a lot on this mailing list and there
> >> even exists a (refused) PEP request in this direction.
> >
> > For reference, it is https://www.python.org/dev/peps/pep-0335/ (the main
> > reason for rejecting the proposal was "too much discussions"...).
> >
> > Perhaps was the proposal too greedy, so i wonder whether there would be a
> > possibility to have a trool adding an Unknown to bool that does not
> > perturb the speed when only True and False are used, and so that the
> > "short-circuiting semantics" remains preserved.
> 
> No way! In an expression such as
> 
>   "True or whatever_function(x)"
> 
> the "whatever_function(x)" is *not* evaluated...
> 
> sage: def f(): print "hello"
> sage: True or f()
> True

I do not see your point. True or Unknown should be True, right ? So we can
shortcut here as well for trools, no ?

Ciao,
Thierry


> 
> > This could indeed be useful in testing equality of overlaping
> > real-intervals, undecidable problems in groups, equality of symbolic
> > expressions, ...
> 
> But I agree that it could be useful.
> 
> Vincent
> 
> -- 
> 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 post to this group, send email to sage-devel@googlegroups.com.
> Visit this group at https://groups.google.com/group/sage-devel.
> For more options, visit https://groups.google.com/d/optout.

-- 
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 post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to