Path: csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed1.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.031 X-Spam-Evidence: '*H*': 0.94; '*S*': 0.00; 'explicitly': 0.05; 'assignment': 0.07; 'python': 0.11; 'def': 0.12; 'local.': 0.16; 'protecting': 0.16; 'variables,': 0.16; 'sat,': 0.16; 'language': 0.16; 'wrote:': 0.18; 'variable': 0.18; 'programming': 0.22; 'rules': 0.22; 'specify': 0.24; 'required.': 0.27; 'header:In- Reply-To:1': 0.27; "doesn't": 0.30; 'said,': 0.30; 'message- id:@mail.gmail.com': 0.30; '-0700,': 0.31; "d'aprano": 0.31; 'depth': 0.31; 'implied': 0.31; 'steven': 0.31; 'received:google.com': 0.35; 'keyword': 0.36; 'subject:?': 0.36; 'too': 0.37; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'to:addr:python.org': 0.39; 'analyze': 0.60; 'skip:n 10': 0.64; 'within': 0.65; 'huh?': 0.84; 'local,': 0.84; 'wanting': 0.93; '2013': 0.98 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=b8w3uLo/gbtzGTHn9vmwztBu9YhojNvo1Kf056jNgwM=; b=WtcGXcosHRsh3fnZ5tSdezEBGf62JoxZenQwOZyyeXAvY9HDOD1xlyFN3COzvn5Okr NS1Rmg4gwcwhv32fVRvw9YmYdS6gL4ycVoLkBWTepsAlUTEnwPsOtpR9amSQXG6ZFTZY NLjKOGlXjLk82pgMdjvZeb9s2Pu+g9AUu0C6spftKEDD6RInX+FzmcxCI4RGKwvlXSSQ Ew76YK3c19iZhkb+vG7UJXlwouC00vBBE/OiV24wGdMwtyzN0vklapMLoxo673ELHySs abK2EdWdmbAuH2pbrk4YufODscIuCYKhGxVeq7Du5bxfgqMTPV84uusBYJlADX1nkfU3 7VGA== X-Received: by 10.68.103.194 with SMTP id fy2mr16826893pbb.158.1372535319106; Sat, 29 Jun 2013 12:48:39 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <51cf3695$0$29999$c3e8da3$5496439d@news.astraweb.com> References: <2a2072e3-4b12-4ada-872c-1240d2379928@googlegroups.com> <51cf2b49$0$29999$c3e8da3$5496439d@news.astraweb.com> <2f5e7801-a4cd-4d01-a1e7-7f67bca18199@googlegroups.com> <51cf3695$0$29999$c3e8da3$5496439d@news.astraweb.com> From: Ian Kelly Date: Sat, 29 Jun 2013 13:47:58 -0600 Subject: Re: Closures in leu of pointers? To: Python Content-Type: text/plain; charset=ISO-8859-1 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 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: 23 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1372535329 news.xs4all.nl 15909 [2001:888:2000:d::a6]:41852 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:49459 On Sat, Jun 29, 2013 at 1:33 PM, Steven D'Aprano wrote: > On Sat, 29 Jun 2013 12:20:45 -0700, cts.private.yahoo wrote: >> Without wanting to analyze it in too much depth now, I >> would want a local keyword to allow me to know I was protecting my >> variables, and a way to specify other scopes, without so much implied >> scoping in non-intuitive ways... > > Huh? What language are you programming in? Python doesn't have implied > scoping in non-intuitive ways. def f(x): def g(y): print(x) x = y Within g, the variable x is implicitly local, which is non-intuitive since without the assignment it would not be. That said, while I think a local keyword would not be unwelcome, I would not want it to be required. Otherwise we end up with the scoping rules of Lua, where everything is global unless explicitly marked as local.