Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #49125
| 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> |
|---|---|
| From | Benjamin Kaplan <benjamin.kaplan@case.edu> |
| Date | 2013-06-24 21:20 -0700 |
| Subject | Re: Is this PEP-able? fwhile |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.3796.1372134435.3114.python-list@python.org> (permalink) |
On Mon, Jun 24, 2013 at 8:54 PM, Chris Angelico <rosuav@gmail.com> wrote: > On Tue, Jun 25, 2013 at 12:01 PM, rusi <rustompmody@gmail.com> wrote: >> On Tuesday, June 25, 2013 3:08:57 AM UTC+5:30, Chris Angelico wrote: >>> On Tue, Jun 25, 2013 at 5:52 AM, <> wrote: >>> >>> > (NOTE: Many people are being taught to avoid 'break' and 'continue' at all >>> > costs... >>> >>> Why? Why on earth should break/continue be avoided? >> >> Because breaks and continues are just goto-in-disguise? >> >> [Well so is while and if and function-call and... Who is to say that?] > > And that's still not a reason imho. You've just pointed out that > they're all control-flow. :) > > ChrisA 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.
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll 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