Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #19053

Re: Comparing None and ints

References <CALWePYyZ85Kbi=0d-ok2j1UPfaWDPi=p-6kkdrJLdmMM+9=xwQ@mail.gmail.com>
Date 2012-01-17 17:50 +1100
Subject Re: Comparing None and ints
From Chris Angelico <rosuav@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.4807.1326783046.27778.python-list@python.org> (permalink)

Show all headers | View raw


On Tue, Jan 17, 2012 at 5:47 PM, Xavier Ho <contact@xavierho.com> wrote:
> What was the rationale behind this design?  Specifically, (None < 0) == True
> and (None == 0) == False?
>
> Personally I would have expected an exception on all tests above.

Compare with Python 3:

>>> None<0
Traceback (most recent call last):
  File "<pyshell#31>", line 1, in <module>
    None<0
TypeError: unorderable types: NoneType() < int()

ChrisA

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: Comparing None and ints Chris Angelico <rosuav@gmail.com> - 2012-01-17 17:50 +1100

csiph-web