Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder7.xlned.com!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.123 X-Spam-Level: * X-Spam-Evidence: '*H*': 0.76; '*S*': 0.00; 'none:': 0.07; '"is"': 0.16; 'none.': 0.16; 'wrote:': 0.18; 'written': 0.21; 'saying': 0.22; 'comparing': 0.24; 'mon,': 0.24; "i've": 0.25; 'header:In- Reply-To:1': 0.27; 'correct': 0.29; 'tim': 0.29; "doesn't": 0.30; 'compared': 0.30; 'returned': 0.30; 'message-id:@mail.gmail.com': 0.30; "i'm": 0.30; 'code': 0.31; 'lines': 0.31; 'chase': 0.31; 'equality': 0.31; 'except': 0.35; 'case,': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'version': 0.36; 'two': 0.37; 'to:addr:python-list': 0.38; 'fact': 0.38; 'pm,': 0.38; 'to:addr:python.org': 0.39; 'up,': 0.60; 'most': 0.60; 'tell': 0.60; 'matter': 0.61; 'different': 0.65; 'mar': 0.68; 'as:': 0.81; 'convinced': 0.93 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=WWDQnTponFIPK96CDvkvYw0zy5pLXujCH8V0Z5Fq9HI=; b=xhnfoH8X42BDwK28VB3JW867/CfIUU9cZUum/CSHF0WX4KntvRkqHkPydZgUKziNe9 E6mHeObh6eEIjX5MstYQla5NCtc0/oOtC3iXLGUVQdi1g9QbhyPXHvJPHNfsroMlcLAr 4TyX6W4bEG0UIscAAU38Y+yzYQVnpfHnZGfwR+EHy5PU7fcPSrhIMlWrA3eFc9Ha19Mo 9PXoQAZMMgAtvorjO3+9Ty7pR5MeqMxn46aP049HT+55qP9Gi2wAHdz06+9z0ekm54Zq RDn/jk1h6qTujnVtlIwwVJgFsXLpnkcvnmUKzkLwol7V1gjJjwAduuzJkVZn8PrLi8p7 scuA== MIME-Version: 1.0 X-Received: by 10.68.129.201 with SMTP id ny9mr22193868pbb.70.1393884134884; Mon, 03 Mar 2014 14:02:14 -0800 (PST) In-Reply-To: <20140303155112.46e34ff8@bigbox.christie.dr> References: <53144e8d$0$2149$426a74cc@news.free.fr> <1d1dfa1b-b715-4d8f-9c12-f0d3dc1a22c9@googlegroups.com> <85ppm3httu.fsf@benfinney.id.au> <20140303155112.46e34ff8@bigbox.christie.dr> Date: Mon, 3 Mar 2014 17:02:14 -0500 Subject: Re: Reference From: Jerry Hill To: "python-list (General)" Content-Type: text/plain; charset=UTF-8 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 24 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1393884138 news.xs4all.nl 2916 [2001:888:2000:d::a6]:39710 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:67593 On Mon, Mar 3, 2014 at 4:51 PM, Tim Chase wrote: > There are a couple use-cases I've encountered where "is" matters: > > 1) the most popular: > > if foo is None: > do_stuff() I know this is the one that always comes up, but honestly, I feel like "is" doesn't matter here. That code would be just as correct if it was written as: if foo == None: do_stuff() The only time it would give you a different result from the "is" version is if foo was bound to an object that returned True when compared with None. And if that were the case, I'm still not convinced that you can tell from looking at those two lines of code which one is buggy, except for the fact that there has been 20 years of custom saying that comparing to None with equality is wrong. -- Jerry