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


Groups > comp.lang.python > #49169

Re: Is this PEP-able? fwhile

Path csiph.com!usenet.pasdenom.info!news.albasani.net!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <ian.g.kelly@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.025
X-Spam-Evidence '*H*': 0.95; '*S*': 0.00; 'subject:PEP': 0.07; 'exit': 0.09; 'explanation': 0.09; 'function,': 0.09; 'benjamin': 0.16; 'exceptions,': 0.16; 'ignored,': 0.16; 'reviewers': 0.16; 'silly': 0.16; 'sorts': 0.16; 'language': 0.16; 'wrote:': 0.18; 'code.': 0.18; 'programming': 0.22; 'rules': 0.22; "i've": 0.25; 'least': 0.26; 'header:In-Reply-To:1': 0.27; 'point': 0.28; 'chris': 0.29; 'am,': 0.29; 'originally': 0.30; 'message- id:@mail.gmail.com': 0.30; '(which': 0.31; 'code': 0.31; 'easier': 0.31; '25,': 0.31; 'sense': 0.34; 'but': 0.35; 'received:google.com': 0.35; "didn't": 0.36; 'two': 0.37; 'being': 0.38; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'does': 0.39; 'heard': 0.39; 'sure': 0.39; 'to:addr:python.org': 0.39; 'called': 0.40; 'even': 0.60; 'subject:? ': 0.60; 'subject:this': 0.83; '"best': 0.84; '"one': 0.84; 'promptly': 0.84; '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:from:date:message-id:subject:to :content-type; bh=NUPHcUjidRHMEAtCkIJ36fi+rVMiYzI3QUDwLtO7/Yo=; b=0LVFBjkGT+GIsrWVxgTv6sl0SyfZ4qFbngxCbj92IQTAK/2wjEhebXZg5D6pQLJnmG BUiOc4THnyQlo7gSgJwYE8n2XhUxamTOajw8e0lG4JLNgr70rx6qJXk44UQd0Olhn89e 6LJZ/ihZ8+sdbXiO+ILKxP9Y737mzMUVm8XHIfQ3VyRS+7OBthuRiVZp4ZhlTq8k+wj7 trbI/gRdV35B756UNAUWJ/SYteH4ljHSs9+hWeRSi45zTjpTD7HxLImFX9JG6So8OoII wOjm+yWH5n5FQ34j/rdcZ6SmPuqXXDuzhHB0025u8q62qja3RRTEj1IHU33726Cft4YP AbhA==
X-Received by 10.68.42.134 with SMTP id o6mr14474752pbl.149.1372176094819; Tue, 25 Jun 2013 09:01:34 -0700 (PDT)
MIME-Version 1.0
In-Reply-To <CAPTjJmpDwMi3UirUMWBpn+mvxtx6Dxf5hisCQ=f_ZYCgzQ06wA@mail.gmail.com>
References <8D03F2B8CF0E7BE-1864-1796B@webmail-m103.sysops.aol.com> <mailman.3773.1372110329.3114.python-list@python.org> <8f813b85-9a4e-4612-82b1-dd58f9bfd497@googlegroups.com> <CAPTjJmo_BD80h14Ab+0KsPQddTabSkZq9HVBb6K8UY-rOXYnFw@mail.gmail.com> <CAMuTYXhDF2Tdw6sL3LPn09E1zBfP5USmnnv_xSQezXkJQgCJqA@mail.gmail.com> <CAPTjJmpDwMi3UirUMWBpn+mvxtx6Dxf5hisCQ=f_ZYCgzQ06wA@mail.gmail.com>
From Ian Kelly <ian.g.kelly@gmail.com>
Date Tue, 25 Jun 2013 10:00:54 -0600
Subject Re: Is this PEP-able? fwhile
To Python <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 <http://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 <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.3835.1372176098.3114.python-list@python.org> (permalink)
Lines 22
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1372176098 news.xs4all.nl 15906 [2001:888:2000:d::a6]:59787
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:49169

Show key headers only | View raw


On Tue, Jun 25, 2013 at 1:21 AM, Chris Angelico <rosuav@gmail.com> wrote:
> On Tue, Jun 25, 2013 at 2:20 PM, Benjamin Kaplan
> <benjamin.kaplan@case.edu> wrote:
>> The reason I was given (which I promptly ignored, of course) is that
>> it's "best practice" to only have one exit point for a block of code.
>> Only one way of terminating your loop, only one "return" per function,
>> never use exceptions, etc. I think it originally came about as a way
>> to make sure that your clean-up code was called (and to make it easier
>> for code reviewers to make sure your clean up code was called) and
>> then started being passed around as a rule among programming teachers
>> who didn't have any experience outside the classroom.
>
> I've heard that "one exit point" rule before, too, but never any
> justification for it. Your explanation does at least make sense
> (albeit only in a language without even RAII), but I don't like silly
> rules like that :)

In my experience the sorts of people who preach "one exit point" are
also all about defining preconditions and postconditions and proving
that the postconditions follow from the preconditions.  I think that
the two are linked, because the "one exit point" rule makes those
sorts of proofs simpler.

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


Thread

Re: Is this PEP-able? fwhile Chris Angelico <rosuav@gmail.com> - 2013-06-25 07:38 +1000
  Re: Is this PEP-able? fwhile rusi <rustompmody@gmail.com> - 2013-06-24 19:01 -0700
    Re: Is this PEP-able? fwhile Chris Angelico <rosuav@gmail.com> - 2013-06-25 13:54 +1000
    Re: Is this PEP-able? fwhile Benjamin Kaplan <benjamin.kaplan@case.edu> - 2013-06-24 21:20 -0700
    Re: Is this PEP-able? fwhile Chris Angelico <rosuav@gmail.com> - 2013-06-25 17:21 +1000
    Re: Is this PEP-able? fwhile Ian Kelly <ian.g.kelly@gmail.com> - 2013-06-25 10:00 -0600
      Re: Is this PEP-able? fwhile rusi <rustompmody@gmail.com> - 2013-06-25 09:19 -0700
        Re: Is this PEP-able? fwhile Neil Cerutti <neilc@norwich.edu> - 2013-06-26 13:09 +0000
    Re: Is this PEP-able? fwhile Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2013-06-25 20:40 -0400
      Re: Is this PEP-able? fwhile jfharden@gmail.com - 2013-06-26 03:00 -0700
      Re: Is this PEP-able? fwhile Jerry Peters <jerry@example.invalid> - 2013-06-26 19:56 +0000

csiph-web