Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #12505
| References | <9cd48486-acd9-4888-9677-0e54fd1eedfd@k15g2000yqd.googlegroups.com> |
|---|---|
| Date | 2011-08-31 10:18 -0700 |
| Subject | Re: Closures and Partial Function Application |
| From | Chris Rebert <clp2@rebertia.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.621.1314811146.27778.python-list@python.org> (permalink) |
On Wed, Aug 31, 2011 at 9:45 AM, Travis Parks <jehugaleahsa@gmail.com> wrote: > I was a little disappointed the other day when I realized that > closures were read-only. I like to use closures quite a bit. Assuming I'm intuiting your question correctly, then you're incorrect; they are "read/write". You just need a `nonlocal` declaration for the variables in question. See http://www.python.org/dev/peps/pep-3104/ and http://docs.python.org/release/3.1.3/reference/simple_stmts.html#nonlocal for details. Cheers, Chris
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Closures and Partial Function Application Travis Parks <jehugaleahsa@gmail.com> - 2011-08-31 09:45 -0700
Re: Closures and Partial Function Application Arnaud Delobelle <arnodel@gmail.com> - 2011-08-31 17:55 +0100
Re: Closures and Partial Function Application Chris Rebert <clp2@rebertia.com> - 2011-08-31 10:18 -0700
Re: Closures and Partial Function Application Travis Parks <jehugaleahsa@gmail.com> - 2011-08-31 10:51 -0700
Re: Closures and Partial Function Application Travis Parks <jehugaleahsa@gmail.com> - 2011-08-31 11:02 -0700
Re: Closures and Partial Function Application Ian Kelly <ian.g.kelly@gmail.com> - 2011-08-31 12:18 -0600
Re: Closures and Partial Function Application Travis Parks <jehugaleahsa@gmail.com> - 2011-08-31 11:26 -0700
Re: Closures and Partial Function Application "bruno.desthuilliers@gmail.com" <bruno.desthuilliers@gmail.com> - 2011-08-31 11:03 -0700
Re: Closures and Partial Function Application Travis Parks <jehugaleahsa@gmail.com> - 2011-08-31 12:33 -0700
Re: Closures and Partial Function Application Terry Reedy <tjreedy@udel.edu> - 2011-08-31 18:21 -0400
Re: Closures and Partial Function Application Piet van Oostrum <piet@vanoostrum.org> - 2011-09-05 16:23 +0200
csiph-web