Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #57891

Re: how to avoid checking the same condition repeatedly ?

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 <rosuav@gmail.com>
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 <mailman.1693.1382953842.18130.python-list@python.org> <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 <rosuav@gmail.com>
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 <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.1745.1383030590.18130.python-list@python.org> (permalink)
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

Show key headers only | View raw


On Tue, Oct 29, 2013 at 5:53 PM, Peter Cacioppi
<peter.cacioppi@gmail.com> 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

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

how to avoid checking the same condition repeatedly ? Wolfgang Maier <wolfgang.maier@biologie.uni-freiburg.de> - 2013-10-28 09:50 +0000
  Re: how to avoid checking the same condition repeatedly ? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-10-28 11:14 +0000
    Re: how to avoid checking the same condition repeatedly ? Chris Angelico <rosuav@gmail.com> - 2013-10-28 22:18 +1100
      Re: how to avoid checking the same condition repeatedly ? Steven D'Aprano <steve@pearwood.info> - 2013-10-29 04:51 +0000
  Re: how to avoid checking the same condition repeatedly ? Piet van Oostrum <piet@vanoostrum.org> - 2013-10-28 14:31 -0400
  Re: how to avoid checking the same condition repeatedly ? Nobody <nobody@nowhere.com> - 2013-10-28 19:37 +0000
    Re: how to avoid checking the same condition repeatedly ? Neil Cerutti <neilc@norwich.edu> - 2013-10-29 13:44 +0000
      Re: how to avoid checking the same condition repeatedly ? rusi <rustompmody@gmail.com> - 2013-10-29 09:13 -0700
  Re: how to avoid checking the same condition repeatedly ? Peter Cacioppi <peter.cacioppi@gmail.com> - 2013-10-28 23:14 -0700
    Re: how to avoid checking the same condition repeatedly ? Chris Angelico <rosuav@gmail.com> - 2013-10-29 17:39 +1100
  Re: how to avoid checking the same condition repeatedly ? Peter Cacioppi <peter.cacioppi@gmail.com> - 2013-10-28 23:53 -0700
    Re: how to avoid checking the same condition repeatedly ? Chris Angelico <rosuav@gmail.com> - 2013-10-29 18:09 +1100
  Re: how to avoid checking the same condition repeatedly ? Peter Cacioppi <peter.cacioppi@gmail.com> - 2013-10-29 16:55 -0700
  Re: how to avoid checking the same condition repeatedly ? alex23 <wuwei23@gmail.com> - 2013-10-30 11:38 +1000
  Re: how to avoid checking the same condition repeatedly ? Mariano Anaya <marianoanaya@gmail.com> - 2013-10-30 06:34 -0700

csiph-web