Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!news.stack.nl!newsfeed.xs4all.nl!newsfeed4a.news.xs4all.nl!xs4all!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.002 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'subject:not': 0.03; 'none:': 0.07; 'subject:two': 0.07; 'from:addr:ethan': 0.09; 'from:addr:stoneleaf.us': 0.09; 'from:name:ethan furman': 0.09; 'message-id:@stoneleaf.us': 0.09; 'none)': 0.09; 'none):': 0.09; 'subject:None': 0.09; '~ethan~': 0.09; '(none,': 0.16; 'simplest': 0.16; 'sat,': 0.16; 'wrote:': 0.18; '>>>': 0.22; 'coding': 0.22; 'header:User-Agent:1': 0.23; 'least': 0.26; 'header:In-Reply- To:1': 0.27; '-0700,': 0.31; "d'aprano": 0.31; 'steven': 0.31; 'seconds': 0.37; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'to:addr:python.org': 0.39; 'skip:u 10': 0.60; 'received:173': 0.61; 'mar': 0.68; 'received:69.56': 0.68; 'received:69.56.148': 0.84; 'received:gateway14.websitewelcome.com': 0.84; 'opt': 0.97 Date: Sat, 29 Mar 2014 16:20:40 -0700 From: Ethan Furman User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:16.0) Gecko/20121010 Thunderbird/16.0.1 MIME-Version: 1.0 To: python-list@python.org Subject: Re: checking if two things do not equal None References: <0245aca0-c6b7-493a-aa52-2c3ef6462dbd@googlegroups.com> <5337195f$0$29994$c3e8da3$5496439d@news.astraweb.com> In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - gator3304.hostgator.com X-AntiAbuse: Original Domain - python.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - stoneleaf.us X-BWhitelist: no X-Source-IP: 173.12.184.233 X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: ([173.12.184.233]) [173.12.184.233]:34310 X-Source-Auth: ethan+stoneleaf.us X-Email-Count: 1 X-Source-Cap: dG9idWs7dG9idWs7Z2F0b3IzMzA0Lmhvc3RnYXRvci5jb20= 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: 27 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1396137094 news.xs4all.nl 2858 [2001:888:2000:d::a6]:58267 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:69357 On 03/29/2014 02:01 PM, Johannes Bauer wrote: > On 29.03.2014 20:05, Steven D'Aprano wrote: >> On Sat, 29 Mar 2014 11:56:50 -0700, contact.trigon wrote: >> >>> if (a, b) != (None, None): >>> or >>> if a != None != b: >>> >>> Preference? Pros? Cons? Alternatives? >> >> if not (a is b is None): ... >> >> Or if you prefer: >> >> if a is not b is not None: ... > > Is this an obfuscated coding contest? Why do you opt for a solution that > one has to at least think 2 seconds about when the simplest solution: > > if (a is not None) or (b is not None): > > is immediately understandable by everyone? +1 -- ~Ethan~