Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #12505

Re: Closures and Partial Function Application

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!xlned.com!feeder5.xlned.com!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <chris@rebertia.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.035
X-Spam-Evidence '*H*': 0.93; '*S*': 0.00; 'subject:Function': 0.09; 'url:peps': 0.09; 'am,': 0.12; 'bit.': 0.16; 'closures': 0.16; 'declaration': 0.16; 'parks': 0.16; 'read-only.': 0.16; 'travis': 0.16; 'cc:addr:python-list': 0.16; 'question.': 0.16; 'wrote:': 0.16; 'wed,': 0.17; 'cheers,': 0.18; 'cc:no real name:2**0': 0.20; 'cc:2**0': 0.22; 'header:In-Reply-To:1': 0.22; 'aug': 0.24; "i'm": 0.27; 'message-id:@mail.gmail.com': 0.29; 'cc:addr:python.org': 0.30; 'disappointed': 0.30; 'url:dev': 0.30; 'chris': 0.32; 'quite': 0.34; 'received:209.85.161': 0.35; 'url:python': 0.36; 'question': 0.36; 'skip:" 10': 0.36; 'assuming': 0.37; 'variables': 0.37; 'received:google.com': 0.38; 'url:org': 0.38; 'received:209.85': 0.38; 'subject:: ': 0.39; 'url:docs': 0.39; 'your': 0.61; '31,': 0.64; 'url:3': 0.67; 'day': 0.69; 'details.': 0.71; 'realized': 0.73; '9:45': 0.84; 'sender:addr:chris': 0.84; 'url:reference': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=rebertia.com; s=google; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=6gYrnSjCt2sTBl/f9DVJlIatyYVj1NP0lnI12rCynLs=; b=ChSK6lmNi8w95/r98nhjALjDrYJgMp+ViCYJhmptAcXkM+Zqs17G5s8qxQjKjrBNWi J9MIM9z6zn/S6y7aph6WQI8Cd8npTVD5bp/moYvj3o1fIBybEfVNLFVS9gZJbvMELJos Xm/YH4UeGFpIomniM98XKF2lpuGFNSshZGrAg=
MIME-Version 1.0
Sender chris@rebertia.com
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 10:18:57 -0700
X-Google-Sender-Auth zgV4CODLcwExz8kaaEuSTeKnt8k
Subject Re: Closures and Partial Function Application
From Chris Rebert <clp2@rebertia.com>
To Travis Parks <jehugaleahsa@gmail.com>
Content-Type text/plain; charset=UTF-8
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.621.1314811146.27778.python-list@python.org> (permalink)
Lines 12
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1314811146 news.xs4all.nl 2480 [2001:888:2000:d::a6]:38491
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:12505

Show key headers only | View raw


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 | NextPrevious in thread | Next in thread | Find similar | Unroll thread


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