Path: csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!us.feeder.erje.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder3.xlned.com!newsfeed1.swip.net!uio.no!news.tele.dk!news.tele.dk!small.news.tele.dk!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.011 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'python,': 0.02; '"as': 0.07; 'subject:same': 0.07; 'python': 0.11; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'language?': 0.16; 'refactoring': 0.16; 'strength': 0.16; 'tends': 0.16; 'subject: ?': 0.16; 'wrote:': 0.18; 'examples': 0.20; '(in': 0.22; 'sort': 0.25; 'header:In-Reply-To:1': 0.27; 'message-id:@mail.gmail.com': 0.30; 'code': 0.31; 'another': 0.32; 'implemented': 0.33; 'subject:the': 0.34; "can't": 0.35; 'but': 0.35; 'received:google.com': 0.35; 'library.': 0.36; 'right?': 0.36; 'done': 0.36; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'to:addr:python.org': 0.39; 'even': 0.60; 'tell': 0.60; "you're": 0.61; 'costs': 0.63; 'careful': 0.91; '2013': 0.98 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:to :content-type; bh=m6OxSdjGpk2A6T14Gsf60ks9TO0OoaBq78ins/RyiDg=; b=bnTlpeOac0mOaD2WBbk6LAxCMahHxDZaExMYMm3WXoxuZSk6aXbjCSrnjOpGYU9Smh 05lruys6sLV7O/wFIF7FtwhuItsNvEb0L62ZfJnRKBSCxYixJp2SZCU2VGuTM1wTw6fp Qf/0sSwYd0xX4lNEnD2zgAU1Ur2VhGZxk49j38hVRJMoczwkRMuRmNy4sbzNSWEFvehT wcjQ4LYgd1xcbQ+CZnNOMFBacLPQingA1WXCHtFLdMpfTyHbVGrVQP6AN89jIWdGtnbf OFF+TorN2r0nIQ6YyfQuGy62C/uUiENRxGb8zNBUslV43tJysOawpyrLHSIHe6SqYAFj f2rg== MIME-Version: 1.0 X-Received: by 10.68.217.226 with SMTP id pb2mr51251pbc.165.1383030582047; Tue, 29 Oct 2013 00:09:42 -0700 (PDT) In-Reply-To: <6a529ff3-5637-42a6-8626-817fc26453a6@googlegroups.com> References: <6a529ff3-5637-42a6-8626-817fc26453a6@googlegroups.com> Date: Tue, 29 Oct 2013 18:09:41 +1100 Subject: Re: how to avoid checking the same condition repeatedly ? From: Chris Angelico To: python-list@python.org Content-Type: text/plain; charset=ISO-8859-1 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: 1383030590 news.xs4all.nl 16008 [2001:888:2000:d::a6]:53029 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:57891 On Tue, Oct 29, 2013 at 5:53 PM, Peter Cacioppi wrote: > But this sort of bottleneck refactoring can be done in a careful way that minimizes the damage to readability. And a strength of py is it tends to encourage this "as pretty as possible" approach to bottleneck refactoring. > > This is what you're saying, right? Yep, that's about the size of it. Want some examples of what costs no clarity to reimplement in another language? Check out the Python standard library. Some of that is implemented in C (in CPython) and some in Python, and you can't tell and needn't care which. Code clarity isn't hurt, because those functions would be named functions even without. ChrisA