Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #12500
| References | <9cd48486-acd9-4888-9677-0e54fd1eedfd@k15g2000yqd.googlegroups.com> |
|---|---|
| Date | 2011-08-31 17:55 +0100 |
| Subject | Re: Closures and Partial Function Application |
| From | Arnaud Delobelle <arnodel@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.616.1314809735.27778.python-list@python.org> (permalink) |
On 31 August 2011 17:45, 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. > > Can someone explain why this limitation exists? Secondly, since I can > cheat by wrapping the thing being closure-ified, how can I write a > simple wrapper that has all the same members as the thing (decorator), > that then applies them to the underlying thing? I don't understand. Can you give an example? > I also like partial function application. What is the easiest way of > achieving this in Python? Would it look something like this: > > def foo(x, y): > return x + y > > xFoo = lambda y: foo(10, y) from functools import partial foo10 = partial(foo, 10) HTH Arnaud
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