Re: [sage-devel] Re: "Tri bool"

2016-11-16 Thread Thierry Dumont
Le 16/11/2016 à 18:01, Volker Braun a écrit : > Exception don't handle the Indeterminate or True => True case. > > If you really need the entire logic then the imho best solution is to be > explicit; Define values True3, False3, Undefined3 that are independent > of booleans and function Bool3.and(

[sage-devel] Re: "Tri bool"

2016-11-16 Thread Volker Braun
Exception don't handle the Indeterminate or True => True case. If you really need the entire logic then the imho best solution is to be explicit; Define values True3, False3, Undefined3 that are independent of booleans and function Bool3.and(), Bool3.or(), ... for logic. On Wednesday, November

[sage-devel] Re: "Tri bool"

2016-11-16 Thread Nils Bruin
On Tuesday, November 15, 2016 at 2:59:06 AM UTC-8, Simon King wrote: > > But I don't see why "too much discussion" should be enough reason to kill > a PEP. After all, it isn't bike shedding but a non-trivial extension > with potentially useful applications. > Guido gives other reasons why he re

[sage-devel] Re: "Tri bool"

2016-11-16 Thread mmarco
The way I would handle those cases, is by raising an exception. The same way that you raise an exception when the software is not able to give any other answer that you might ask. El martes, 15 de noviembre de 2016, 8:22:15 (UTC+1), tdumont escribió: > > When developing a software which aims to

[sage-devel] Re: "Tri bool"

2016-11-15 Thread Simon King
Hi Vincent, On 2016-11-15, Vincent Delecroix <20100.delecr...@gmail.com> wrote: > Indeed, __or__ is for the operator |. "or" can not be overridden. > > sage: class a(object): > : def __or__(self, other): > : return "hello" > sage: a() or True ><__main__.a object at 0x7f2549683b

Re: [sage-devel] Re: "Tri bool"

2016-11-15 Thread Vincent Delecroix
Hi Simon, On 15 November 2016 at 11:44, Simon King wrote: > Hi Vincent, > > [...] > >> Python is using __nonzero__ to deal with these or/and/not operators. >> This method __nonzero__ implicitly defines the conversion to booleans. >> And Python sets >> >> x or y := x if bool(x) is True and y other

[sage-devel] Re: "Tri bool"

2016-11-15 Thread Simon King
Hi Vincent, sorry for my previous post, as you discussed the example already. On 2016-11-15, Vincent Delecroix <20100.delecr...@gmail.com> wrote: > There is still a semantic problem to solve the following > > sage: Unknown or False > False No. Unknown or False is Unknown. The shortcuts would be

[sage-devel] Re: "Tri bool"

2016-11-15 Thread Simon King
Hi Vincent, On 2016-11-15, Vincent Delecroix <20100.delecr...@gmail.com> wrote: >>> 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