Why prefer != over <> for Python 3.0?

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Sun Mar 30 05:10:12 EDT 2008


En Sun, 30 Mar 2008 05:08:34 -0300, <dewitters at gmail.com> escribió:
> On Mar 29, 12:41 pm, Steven D'Aprano <st... at REMOVE-THIS-
> cybersource.com.au> wrote:

>> Since you jump to an invalid conclusion about !=, the rest of your
>> argument fails.
>
> No, you said <= could be confusing, but we're talking about <> here,
> and there is no confusion about that :).

Yes, there is: <> looks like "less or greater", and being equal or not is  
a different thing that being less or greater. Trichotomy law holds for  
real numbers (although some people don't even accept that) but not for  
floating point (NANs); and Python isn't about numbers only. For a lot of  
objects it makes sense to compare them for equality or not, but you can't  
say which one is greater than the other (the weather forecast, books in a  
bookstore)

-- 
Gabriel Genellina




More information about the Python-list mailing list