Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!us.feeder.erje.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed4a.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.006 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'subject:not': 0.03; "subject:' ": 0.07; '"is': 0.16; '"is"': 0.16; 'none.': 0.16; 'object()': 0.16; 'sentinel': 0.16; 'wrote:': 0.18; 'aug': 0.22; 'skip': 0.24; 'this:': 0.26; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; 'message-id:@mail.gmail.com': 0.30; 'comparison': 0.31; 'created': 0.35; 'received:google.com': 0.35; 'false': 0.36; 'should': 0.36; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=AbGXpNqBSZ1kVcMoYmsHyBI2lqaeIakJSEOQX5xCtTM=; b=HY3rG4/yh2ZvAcq5UA5+qJEByJDqWmhMRdjwd6pOQozKGl2SjZE747iTeLmjlW2RGc OY6wp4br1IH3jqgPiVJwqC90ScKCXZ+Kt+k/elB/iO8bKJefIJEBn+9FX2rR7Xk55ytB cW+TL+1sIopVbr/a8SYJYyYTtSOKngJu4moGbJnsBYwDCEYS8U6zA0LODASSg/vstXeh P3BNiKUGZiCZJJodC8vY3XiRUxGqzAkmPfIx/jzej3mNmnWX3qT+wIDsbKzPXYPwCwrr RPgvHSkY/xEIpOVn6+FGh/jBssZXW0dahh+XJPypwdssD4pImIZ7IuMvwB5SP+cQtYSN ZhEw== X-Received: by 10.66.146.70 with SMTP id ta6mr16753038pab.131.1408466609372; Tue, 19 Aug 2014 09:43:29 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: References: <87fvgt7c4i.fsf@elektro.pacujo.net> <53F27340.90604@stoneleaf.us> From: Ian Kelly Date: Tue, 19 Aug 2014 10:42:49 -0600 Subject: Re: 'is not' or '!=' To: Python 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: 14 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1408466618 news.xs4all.nl 2851 [2001:888:2000:d::a6]:51818 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:76576 On Tue, Aug 19, 2014 at 7:12 AM, Skip Montanaro wrote: > The use of "is" or "is not" is the right thing to do when the object > of the comparison is known to be a singleton. That is true for None. > (I suspect it's true for True and False as well, though for historical > and idiomatic reasons "x is True" is never used.) It would also be > true if you created a sentinel object like this: > > SENTINEL = [] When I need to do this, I use: SENTINEL = object() It's still a singleton, and why should a sentinel be mutable?