Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #49473
| References | (5 earlier) <51cf3695$0$29999$c3e8da3$5496439d@news.astraweb.com> <CALwzidm4YBa_DgTUTKAxnnirg1Uxuyds8kWf=urh+rQd=ct5Hg@mail.gmail.com> <kqnhgf$2fe$1@ger.gmane.org> <CALwzidk+0H+5pi_Wx4ymBFDuZ4UKt1O-3FY5p2UfuDPpf=nXcg@mail.gmail.com> <kqocdd$n7u$1@ger.gmane.org> |
|---|---|
| Date | 2013-06-30 15:08 +1000 |
| Subject | Re: Closures in leu of pointers? |
| From | Chris Angelico <rosuav@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.4018.1372568890.3114.python-list@python.org> (permalink) |
On Sun, Jun 30, 2013 at 2:32 PM, Terry Reedy <tjreedy@udel.edu> wrote: > On 6/29/2013 5:21 PM, Ian Kelly wrote: >> >> On Sat, Jun 29, 2013 at 2:53 PM, Terry Reedy <tjreedy@udel.edu> wrote: >>> >>> # The alternative for either program or people is a 1-pass + backtracking >>> process where all understandings are kept provisional until the end of >>> the >>> body and revised as required. 2 passes are simpler. >> >> >> Or simply an explicit declaration of scope at the beginning of the >> function definition. > > > One of the reasons I switched to Python was to not have to do that, or > hardly ever. For valid code, an new declaration is hardly needed. Parameters > are locals. If the first use of another name binds it (and that includes > import, class, and def), it is local. If the first use of does not bind it, > it had better not be local (because if it is, there well be an exception). > If there are branches, each should be consistent with the others. One should > only need two readings to understand and fix unbound local errors. This is strictly a matter of opinion, and one on which mine differs from yours. I think explicit declarations are better than implicit "you've assigned to this name" local creations; the declarations help to catch typos. Also, I like the consistency of C-style declarations - where-ever you declare something, it's valid from there "in", and not "out". Without declarations, there's a magical scope boundary at a function definition that's different from the non-boundary at a loop, for instance. But that's just my opinion. and as Teresa says, I'm only one, and possibly I'm wrong. ChrisA
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Closures in leu of pointers? cts.private.yahoo@gmail.com - 2013-06-29 02:34 -0700
Re: Closures in leu of pointers? Fábio Santos <fabiosantosart@gmail.com> - 2013-06-29 10:42 +0100
Re: Closures in leu of pointers? Peter Otten <__peter__@web.de> - 2013-06-29 12:01 +0200
Re: Closures in leu of pointers? cts.private.yahoo@gmail.com - 2013-06-29 04:21 -0700
Re: Closures in leu of pointers? cts.private.yahoo@gmail.com - 2013-06-29 04:44 -0700
Re: Closures in leu of pointers? Peter Otten <__peter__@web.de> - 2013-06-29 14:12 +0200
Re: Closures in leu of pointers? cts.private.yahoo@gmail.com - 2013-06-29 05:26 -0700
Re: Closures in leu of pointers? Mark Lawrence <breamoreboy@yahoo.co.uk> - 2013-06-29 15:37 +0100
Re: Closures in leu of pointers? cts.private.yahoo@gmail.com - 2013-06-29 07:48 -0700
Re: Closures in leu of pointers? Michael Torrie <torriem@gmail.com> - 2013-06-29 07:56 -0600
Re: Closures in leu of pointers? Michael Torrie <torriem@gmail.com> - 2013-06-29 12:36 -0600
Re: Closures in leu of pointers? Michael Torrie <torriem@gmail.com> - 2013-06-29 08:02 -0600
Re: Closures in leu of pointers? Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2013-06-29 19:02 +0200
Re: Closures in leu of pointers? rusi <rustompmody@gmail.com> - 2013-06-29 10:33 -0700
Re: Closures in leu of pointers? cts.private.yahoo@gmail.com - 2013-06-29 11:37 -0700
Re: Closures in leu of pointers? Michael Torrie <torriem@gmail.com> - 2013-06-29 12:58 -0600
Re: Closures in leu of pointers? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-06-29 18:59 +0000
Re: Closures in leu of pointers? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-06-29 18:51 +0000
Re: Closures in leu of pointers? Michael Torrie <torriem@gmail.com> - 2013-06-29 13:04 -0600
Re: Closures in leu of pointers? rusi <rustompmody@gmail.com> - 2013-06-29 12:11 -0700
Re: Closures in leu of pointers? Michael Torrie <torriem@gmail.com> - 2013-06-29 12:35 -0600
Re: Closures in leu of pointers? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-06-29 19:19 +0000
Re: Closures in leu of pointers? Tim Chase <tim@thechases.com> - 2013-06-29 14:42 -0500
Re: Closures in leu of pointers? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-06-30 01:41 +0000
Re: Closures in leu of pointers? Joshua Landau <joshua.landau.ws@gmail.com> - 2013-06-29 21:02 +0100
Re: Closures in leu of pointers? Michael Torrie <torriem@gmail.com> - 2013-06-29 16:02 -0600
Re: Closures in leu of pointers? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-06-29 18:45 +0000
Re: Closures in leu of pointers? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-06-29 19:00 +0000
Re: Closures in leu of pointers? cts.private.yahoo@gmail.com - 2013-06-29 12:20 -0700
Re: Closures in leu of pointers? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-06-29 19:33 +0000
Re: Closures in leu of pointers? cts.private.yahoo@gmail.com - 2013-06-29 12:34 -0700
Re: Closures in leu of pointers? Ian Kelly <ian.g.kelly@gmail.com> - 2013-06-29 13:47 -0600
Re: Closures in leu of pointers? Terry Reedy <tjreedy@udel.edu> - 2013-06-29 16:53 -0400
Re: Closures in leu of pointers? rusi <rustompmody@gmail.com> - 2013-06-30 01:56 -0700
Re: Closures in leu of pointers? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-06-30 11:22 +0000
Re: Closures in leu of pointers? rusi <rustompmody@gmail.com> - 2013-06-30 04:42 -0700
Re: Closures in leu of pointers? Ian Kelly <ian.g.kelly@gmail.com> - 2013-06-29 15:21 -0600
Re: Closures in leu of pointers? cts.private.yahoo@gmail.com - 2013-06-29 14:30 -0700
Re: Closures in leu of pointers? Terry Reedy <tjreedy@udel.edu> - 2013-06-30 00:32 -0400
Re: Closures in leu of pointers? Chris Angelico <rosuav@gmail.com> - 2013-06-30 15:08 +1000
Re: Closures in leu of pointers? rusi <rustompmody@gmail.com> - 2013-06-30 00:36 -0700
Re: Closures in leu of pointers? Ian Kelly <ian.g.kelly@gmail.com> - 2013-06-29 23:46 -0600
Re: Closures in leu of pointers? alex23 <wuwei23@gmail.com> - 2013-07-01 14:57 +1000
Re: Closures in leu of pointers? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-07-01 07:36 +0000
Re: Closures in leu of pointers? Chris Angelico <rosuav@gmail.com> - 2013-06-30 15:59 +1000
Re: Closures in leu of pointers? Terry Reedy <tjreedy@udel.edu> - 2013-06-30 02:11 -0400
Re: Closures in leu of pointers? Ian Kelly <ian.g.kelly@gmail.com> - 2013-06-30 00:24 -0600
Re: Closures in leu of pointers? Michael Torrie <torriem@gmail.com> - 2013-06-29 16:03 -0600
Re: Closures in leu of pointers? Ian Kelly <ian.g.kelly@gmail.com> - 2013-06-29 13:23 -0600
Re: Closures in leu of pointers? Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2013-06-30 12:07 +0200
Re: Closures in leu of pointers? Ian Kelly <ian.g.kelly@gmail.com> - 2013-06-30 11:13 -0600
Re: Closures in leu of pointers? Ian Kelly <ian.g.kelly@gmail.com> - 2013-06-30 11:18 -0600
csiph-web