Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #12500
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <arnodel@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.002 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'python?': 0.05; 'wrapper': 0.07; 'subject:Function': 0.09; 'underlying': 0.09; 'def': 0.15; 'bit.': 0.16; 'closures': 0.16; 'example?': 0.16; 'exists?': 0.16; 'foo(10,': 0.16; 'functools': 0.16; 'lambda': 0.16; 'parks': 0.16; 'read-only.': 0.16; 'thing?': 0.16; 'travis': 0.16; 'cc:addr :python-list': 0.16; 'this:': 0.16; 'wrote:': 0.16; 'cc:no real name:2**0': 0.20; 'cc:2**0': 0.22; 'header:In-Reply-To:1': 0.22; 'function': 0.27; 'import': 0.28; 'message-id:@mail.gmail.com': 0.29; 'cc:addr:python.org': 0.30; 'disappointed': 0.30; 'someone': 0.34; 'quite': 0.34; 'received:209.85.161': 0.35; 'explain': 0.36; 'limitation': 0.37; 'partial': 0.37; 'something': 0.37; 'members': 0.37; 'easiest': 0.38; 'received:google.com': 0.38; 'received:209.85': 0.38; 'subject:: ': 0.39; 'why': 0.39; 'day': 0.69; 'august': 0.70; 'realized': 0.73; '10)': 0.84 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=HG8US+sYE2HZ0rFoJ3VCrWjmoGptu/EzfdDGgibFKtY=; b=TGhYu+29d8R6IlGA6JsO4eXKLsympJ6ZAMXH7dpOYp6F24onmWhXZzkgJYA7c403GE +KbCmfGPbnpVigcc6Ssqx5970iB3QVQlmOspt+gzL44rr/o1I1hbDjeAbWEqV/ZRoei6 +J8vTQo8YMwRmHja4ABaS7I66s3xkfbMu9ar0= |
| MIME-Version | 1.0 |
| In-Reply-To | <9cd48486-acd9-4888-9677-0e54fd1eedfd@k15g2000yqd.googlegroups.com> |
| References | <9cd48486-acd9-4888-9677-0e54fd1eedfd@k15g2000yqd.googlegroups.com> |
| Date | Wed, 31 Aug 2011 17:55:34 +0100 |
| Subject | Re: Closures and Partial Function Application |
| From | Arnaud Delobelle <arnodel@gmail.com> |
| To | Travis Parks <jehugaleahsa@gmail.com> |
| Content-Type | text/plain; charset=UTF-8 |
| Content-Transfer-Encoding | quoted-printable |
| Cc | python-list@python.org |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.12 |
| 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.616.1314809735.27778.python-list@python.org> (permalink) |
| Lines | 26 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1314809735 news.xs4all.nl 2448 [2001:888:2000:d::a6]:35355 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.python:12500 |
Show key headers only | View raw
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