On 2008-01-25, Steven D'Aprano <[EMAIL PROTECTED]> wrote:
> On Fri, 25 Jan 2008 07:57:13 +0000, Antoon Pardon wrote:
>
>>> But if you consider that having "x is not smaller than y" be equivalent
>>> to "x is greater than or equal to y" is more important than forcing a
>>> boolean answer in the first place, then you need something to signal
>>> Undefined, and an exception is the right solution unless you have
>>> multi- valued logic system (True, False, Maybe, Undefined, ...)
>> 
>> Why should we consider that? 
>
> It's a value judgement. Ask the Apple and IBM engineers and 
> mathematicians.
>
> Personally, I think it is more useful to be able to assume that if x is 
> not less than y, it must be greater or equal to instead ("completeness"), 
> than it is to have a guarantee that x < y will never raise an exception.
>
> Having said that, I think the opposite holds for sorting and calculating 
> the min() and max() of floats. Sorting should push the NaNs to one end of 
> the list (I don't care which) while min() and max() should ignore NaNs 
> and only raise an exception if all the arguments are NaNs.

My personal preference would be that python would allow people the
choice, with the default being that any operation that resulted
in a non numeric result would throw an exception.

People who somehow made it clear they know how to work with inf, and
NaN results, would get silent NaN where no exceptions would be thrown.

Maybe an intermediate level like  what the Apple and IBM engineers
use, could be usefull too.

>> The world is full of partial orders. In
>> python we have sets and a partial order is perfectly mathematically
>> sound.
>
> Sure, we could define floats to have any sort of order we want. We could 
> define them to be ordered by their English spelling so that "five million 
> point three" would be less than "zero point one". But is it useful?
>
> Putting aside sorting and max/min, what is the use-case for having 
> comparisons with NaN succeed? What benefit will it give you?

I guess the same benefit it gives to those that have operations with
NaN succeed. If 3 * NaN should succeed and all sort of other stuff,
why suddenly make an exception for 3 < NaN.

-- 
Antoon Pardon
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to