Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.018 X-Spam-Evidence: '*H*': 0.96; '*S*': 0.00; 'subject:Python': 0.05; 'attribute': 0.07; 'object?': 0.09; 'storing': 0.09; 'antti': 0.16; 'cc:addr:python-list': 0.16; 'wrote:': 0.18; 'cheers,': 0.20; 'cc:no real name:2**0': 0.21; 'header:In-Reply-To:1': 0.22; 'feb': 0.22; 'received:74.125.82.174': 0.24; 'sat,': 0.25; 'cc:2**0': 0.26; 'function': 0.27; 'looks': 0.27; "i'm": 0.28; 'message-id:@mail.gmail.com': 0.29; 'cc:addr:python.org': 0.29; 'pm,': 0.29; 'that,': 0.32; 'done': 0.34; '...': 0.35; 'received:74.125.82': 0.36; 'but': 0.37; 'received:google.com': 0.37; 'using': 0.37; 'subject:with': 0.37; 'think': 0.38; 'received:74.125': 0.38; 'is.': 0.63; 'enclosed': 0.68; '9:19': 0.84; 'naughty': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=ADzg8ajYHakHpMXkO3ydUTWzXRUuhLQJXQFIyUKuJ/Q=; b=xivt1JyFze8jpfj2mOyzxct1QGDusskaE3FV75Ny1S2K8BQ5PIqdLh9zZFPvqP/buG jK+ys0jsVtrMsFgNGXnOJKtluF6VoLqdcnsokbkccwxAp0GLZM7S2+eJ1DhIdz1aZaae /MDilJBlld27VZk3Hm5xo9c36/HBiZTOx7FNY= MIME-Version: 1.0 In-Reply-To: References: From: Ian Kelly Date: Sun, 5 Feb 2012 13:58:31 -0700 Subject: Re: Common LISP-style closures with Python To: Antti J Ylikoski Content-Type: text/plain; charset=ISO-8859-1 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 15 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1328475544 news.xs4all.nl 6891 [2001:888:2000:d::a6]:35687 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:19876 On Sat, Feb 4, 2012 at 9:19 PM, Antti J Ylikoski wrote: >> I'm not sure how naughty this is, but the same thing can be done without >> using >> nonlocal by storing the local state as an attribute of the enclosed >> function >> object: >> >> ... > > Yes, I do know that, but then it would not be a closure :-))))))))) Sure it is. Where do you think it looks up the function object? Cheers, Ian