Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed1.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.021 X-Spam-Evidence: '*H*': 0.96; '*S*': 0.00; 'subject:not': 0.03; 'subject:two': 0.07; 'subject:None': 0.09; 'cc:addr:python-list': 0.11; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'iteration': 0.16; 'wrote:': 0.18; 'cheap': 0.19; 'tests': 0.22; 'cc:addr:python.org': 0.22; 'cc:2**0': 0.24; 'header:In-Reply- To:1': 0.27; 'function': 0.29; 'correct': 0.29; 'am,': 0.29; 'tim': 0.29; 'message-id:@mail.gmail.com': 0.30; 'chase': 0.31; 'checking': 0.33; 'possible.': 0.35; 'something': 0.35; 'received:google.com': 0.35; 'version': 0.36; 'doing': 0.36; 'useful': 0.36; 'mine': 0.38; '30,': 0.65; 'mar': 0.68; 'costly': 0.84; 'presumably': 0.84; 'to:none': 0.92 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:cc :content-type; bh=hIDe2Zs0sXJLq7cwJF+QuRenXeuOJCnrJMARNmqyKgI=; b=XGqmb1iZgjBwXhqZu7JVFlzNKnn+jLoBnxUnT9Kabb/prUo1xG21JWc8nV4bCR6Xfb aod/mSAlYEJVYrqScUAZ5xGrEfFtZ249sS9qLzxv/3KVncS5Q2pr+L/e4yioXqQf3S3d hL4Iqbc9+xQW/dlxcBfVF0IwfKSD5/04PvAvmP8hdS5WBYs4YmG2vavItSef+EtCQoTi gFBMNFVsgzuUbQJC10Uyg8JVFlb6MYJOOtr4gDeB8vssscROvTRdBtdemUm6unG0s7Mp AxVgL+UreZRLvn0ztO2yVD33b0xH8mkdkOGcDg/up9iF156zE3RZ7m4QSSxkZVqZneHp ff0g== MIME-Version: 1.0 X-Received: by 10.68.218.3 with SMTP id pc3mr16446668pbc.71.1396135069910; Sat, 29 Mar 2014 16:17:49 -0700 (PDT) In-Reply-To: <20140329174653.4969807f@bigbox.christie.dr> References: <0245aca0-c6b7-493a-aa52-2c3ef6462dbd@googlegroups.com> <5337195f$0$29994$c3e8da3$5496439d@news.astraweb.com> <20140329173655.4022d715@bigbox.christie.dr> <20140329174653.4969807f@bigbox.christie.dr> Date: Sun, 30 Mar 2014 10:17:49 +1100 Subject: Re: checking if two things do not equal None From: Chris Angelico Cc: "python-list@python.org" 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: 13 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1396135079 news.xs4all.nl 2954 [2001:888:2000:d::a6]:52315 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:69355 On Sun, Mar 30, 2014 at 9:46 AM, Tim Chase wrote: > Though am I correct that your iteration tests for equality, while > mine tests for identity? Also, my version bails early in the event > quitting early is possible. That's particularly useful in the case > of doing something like > > if all(x() is None for x in [func1, func2, func3, costly_func]): > do_something() Presumably you mean to actually call those functions, as checking the identity of a costly function is still cheap :) ChrisA