Path: csiph.com!usenet.pasdenom.info!news.redatomik.org!newsfeed.xs4all.nl!newsfeed3a.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.013 X-Spam-Evidence: '*H*': 0.97; '*S*': 0.00; 'explicit': 0.07; 'test,': 0.07; 'len(x)': 0.09; 'cc:addr:python-list': 0.11; 'boolean': 0.16; 'determining': 0.16; 'emptiness': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'global.)': 0.16; 'merely': 0.16; 'wrote:': 0.18; 'manual': 0.22; 'cc:addr:python.org': 0.22; 'exists': 0.24; 'cc:2**0': 0.24; '15,': 0.26; 'query': 0.26; 'header:In-Reply-To:1': 0.27; "doesn't": 0.30; 'message-id:@mail.gmail.com': 0.30; "d'aprano": 0.31; 'implicit': 0.31; 'steven': 0.31; 'figure': 0.32; 'fri,': 0.33; 'objects': 0.35; 'test': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'pm,': 0.38; 'how': 0.40; 'even': 0.60; 'more': 0.64; 'capable': 0.67; 'results': 0.69; '2015': 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=xVjEUXwq/evtZOd009iuEpMhjYOK5Rpqy+hvRM/URBM=; b=VGzOXNwKE/XDiGWfxSHujt2ttpQEwK1hsccQL/f6E/LILFoXnOr8i9UT/qdRo8glhZ cf9FqMEvVxFH7nUeQTY/icKPN6E/amJ/dD4IisgbF4/Y3ad7MMZHFF1NzySb1+QZNdKE oSs2LVXkLTGm2RewqbhK7cydMbkbwl+egW3zEi2ciOrtW4Io+sW63sZJfwwBWlQ0PH5e ie242oUfk/5foPRfDD3Ihxgzw6hMCpYLMdjOrYH10j5UOTWkW8YEWDJLebtDyeLWGCqY NUvanLJdDfxcMo87CGqcbUnSL8k52O3LfZKGL2a4Z7TQyCaI+Wl2vefzVRJY5kyJI0ko jyxA== MIME-Version: 1.0 X-Received: by 10.50.66.172 with SMTP id g12mr24124380igt.34.1431685522995; Fri, 15 May 2015 03:25:22 -0700 (PDT) In-Reply-To: <5555c708$0$13009$c3e8da3$5496439d@news.astraweb.com> References: <7JN4x.37133$Q41.15375@fx25.am4> <6w35x.645690$I97.19867@fx31.am4> <874mnfunpn.fsf@elektro.pacujo.net> <87bnhmgqrx.fsf@elektro.pacujo.net> <5555c708$0$13009$c3e8da3$5496439d@news.astraweb.com> Date: Fri, 15 May 2015 20:25:22 +1000 Subject: Re: Building CPython 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.20+ 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: 1431685525 news.xs4all.nl 2905 [2001:888:2000:d::a6]:48732 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:90663 On Fri, May 15, 2015 at 8:14 PM, Steven D'Aprano wrote: > (If anything, using an implicit boolean test will be faster than an > explicit manual test, because it doesn't have to call the len() global.) Even more so: Some objects may be capable of determining their own lengths, but can ascertain their own emptiness more quickly. So len(x) might have to chug chug chug to figure out exactly how many results there are (imagine a database query or something), where bool(x) merely has to see whether or not a single one exists (imagine a database query with "LIMIT 1" tacked on). ChrisA