Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed5.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.010 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'run-time': 0.05; 'python': 0.08; 'builtin': 0.09; 'likely.': 0.09; 'runtime': 0.09; 'tends': 0.09; 'developer': 0.12; 'cc:addr:python-list': 0.15; 'mon,': 0.15; 'check?': 0.16; 'myself?': 0.16; 'subject:() ': 0.16; 'cheers,': 0.18; 'wrote:': 0.18; '(which': 0.19; 'cc:no real name:2**0': 0.21; 'unlikely': 0.23; 'header:In-Reply-To:1': 0.23; 'cc:2**0': 0.25; 'expect': 0.25; 'code': 0.25; 'function': 0.27; 'cc:addr:python.org': 0.29; 'message-id:@mail.gmail.com': 0.29; 'cases.': 0.30; 'chris': 0.30; '(e.g.': 0.30; 'subject:?': 0.31; 'nov': 0.31; 'pm,': 0.31; 'regardless': 0.31; 'someone': 0.33; 'latter': 0.34; 'towards': 0.35; 'received:209.85.161': 0.35; 'explain': 0.36; '(to': 0.36; '(not': 0.37; 'received:google.com': 0.38; 'received:209.85': 0.38; "it's": 0.39; 'subject:: ': 0.39; 'difference': 0.40; 'received:209': 0.40; 'being': 0.40; 'really': 0.40; 'your': 0.61; '2011': 0.62; '1:00': 0.84; 'debunk': 0.84; 'sender:addr:chris': 0.84; 'lean': 0.91; 'to:none': 0.93 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rebertia.com; s=google; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:cc:content-type :content-transfer-encoding; bh=RuIaWkl7UnNCfat9x/QA1xzMTfg/WPetbG2FnVFuuwA=; b=WtiWO8aduiJUcnwsoIyD3gMrxcGn19/SwayfPH9CDltumPgXaB6MedcBYU0uCQ8BrQ 5MEkRxMUVWl0M1xucHJXU/0xHE1vH0UYy7j1vcXkP9DRJZmW7UnGCrBkViLJGWjaIWiR E4cMy6DcTWKu/hWAY11HWOzxhybTPqZyssobs= MIME-Version: 1.0 Sender: chris@rebertia.com In-Reply-To: References: Date: Mon, 7 Nov 2011 13:39:57 -0800 X-Google-Sender-Auth: 7LBojTXVBv1Wu1l1ARrCQuRSFFY Subject: Re: all() is slow? From: Chris Rebert Cc: python-list@python.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 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: 22 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1320702006 news.xs4all.nl 6967 [2001:888:2000:d::a6]:43445 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:15440 On Mon, Nov 7, 2011 at 1:00 PM, OKB (not okblacke) wrote: > =C2=A0 =C2=A0 =C2=A0 =C2=A0What is the point of the all() function being = a builtin if it's > slower than writing a function to do the check myself? Regardless of whether it's slower (which I expect someone will be along to debunk or explain shortly), do you really want to have to write an additional boilerplate function or block of code /every single time/ you want to do such a check? The runtime speed difference is unlikely to be worth your time as a developer in many cases. And by Murphy's Law, you *will* make errors writing these repetitive code blocks (e.g. forget to negate the conditional), whereas reusing all() makes that much less likely. The trade-off is run-time speed for developer productivity/convenience; Python tends to lean towards the latter (to varying degrees). Cheers, Chris