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


Groups > comp.lang.python > #19053

Re: Comparing None and ints

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.002
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'python': 0.08; 'design?': 0.09; 'subject:None': 0.09; 'types:': 0.09; 'exception': 0.12; 'received:209.85.210.174': 0.13; 'received:mail- iy0-f174.google.com': 0.13; '(none': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'rationale': 0.16; 'xavier': 0.16; 'wrote:': 0.16; '>>>': 0.18; 'jan': 0.19; 'header :In-Reply-To:1': 0.22; 'tests': 0.25; 'pm,': 0.26; 'compare': 0.28; 'message-id:@mail.gmail.com': 0.28; 'typeerror:': 0.30; 'tue,': 0.32; 'to:addr:python-list': 0.33; '17,': 0.34; 'received:google.com': 0.37; 'received:209.85': 0.38; 'skip:\xa0 10': 0.38; 'received:209': 0.39; 'expected': 0.39; 'subject:: ': 0.39; 'to:addr:python.org': 0.40
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; bh=+5NtKJM+Mg0CT2JN2BxztTWDeCPCbDRfyqKZuw8jWq4=; b=BpfAt5xQ4hMhYbsaNr9qiTzhUpKaidEDl++cPdB5dtRMP4+5BqHFFQ8gSHtPqg/oqW TUMEBeJUK9aaP6si8wUWu+rJY80nRf9CEDJAwtj5LA55YGPFFAFFH9dwdeFcjK5Qx0Bh q30q8/PkJGas6TGomZ930edcbBdAQYBGsnw9I=
MIME-Version 1.0
In-Reply-To <CALWePYyZ85Kbi=0d-ok2j1UPfaWDPi=p-6kkdrJLdmMM+9=xwQ@mail.gmail.com>
References <CALWePYyZ85Kbi=0d-ok2j1UPfaWDPi=p-6kkdrJLdmMM+9=xwQ@mail.gmail.com>
Date Tue, 17 Jan 2012 17:50:43 +1100
Subject Re: Comparing None and ints
From Chris Angelico <rosuav@gmail.com>
To python-list@python.org
Content-Type text/plain; charset=ISO-8859-1
Content-Transfer-Encoding quoted-printable
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.4807.1326783046.27778.python-list@python.org> (permalink)
Lines 16
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1326783046 news.xs4all.nl 6900 [2001:888:2000:d::a6]:55421
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:19053

Show key headers only | 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