Why is None <= 0

Grant Edwards grante at visi.com
Fri Apr 25 15:01:59 EDT 2008


On 2008-04-25, Gregor Horvath <gh at gregor-horvath.com> wrote:
> Hi,
>
> >>> None <= 0
> True
>
> Why?

Comparing objects of differing types produces an undefined
result.  Next time you do it, it might return False. (Well,
it's not really going to, but it's allowed to.)

> Is there a logical reason?

For what?  There's no reason it returns true rather than false.
The more interesting question is why doesn't it raise an
exception.  <ducks>

-- 
Grant Edwards                   grante             Yow! These PRESERVES should
                                  at               be FORCE-FED to PENTAGON
                               visi.com            OFFICIALS!!



More information about the Python-list mailing list