>> Not my idea. This was the way it worked in MuPAD. There was a three state
>> boolean value, which was quite useful. Looking into python docs to see if 
>> we
>> can have "and" and "or" work with a 3-state booleans, I found:
>>
>> " A rich comparison method may return the singleton NotImplemented if it 
>> does
>> not implement the operation for a given pair of arguments. By convention,
>> False and True are returned for a successful comparison. However, these
>> methods can return any value, so if the comparison operator is used in a
>> Boolean context (e.g., in the condition of an if statement), Python will 
>> call
>> bool() on the value to determine if the result is true or false. "
>
> We do this to get symbolic equations.
>
>> Wouldn't it be mor meaningful to return NotImplemented ?
>
> No. If a.__richcmp__(b) returns NotImplemented then b.__richcmp__(a) is 
> attempted (basically). Also, the value is truly unkownable, so Unknowns is 
> the right thing to return here.

One of the main problem here is that PEP 335 "Overloadable Boolean Operators"
is not yet accepted. So right now there is no way to implement a three state
logic, is there one ? If not, Is there a way we can push on python dev to have
this PEP accepted ?

Cheers,

Florent

-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

Reply via email to