Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.002 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'true,': 0.05; 'subject:Python': 0.06; 'referring': 0.07; 'variables': 0.07; 'beginners': 0.09; 'option,': 0.09; 'variables.': 0.09; 'cc:addr :python-list': 0.11; 'python': 0.11; 'changes': 0.15; 'agree.': 0.16; 'change;': 0.16; 'confuse': 0.16; 'demonstrably': 0.16; 'discussion.': 0.16; 'finney': 0.16; 'guilty': 0.16; 'immutable,': 0.16; 'item)': 0.16; 'to:addr:pearwood.info': 0.16; 'to:addr:steve+comp.lang.python': 0.16; "to:name:steven d'aprano": 0.16; 'variable.': 0.16; 'variables,': 0.16; 'variables:': 0.16; 'varies': 0.16; 'when,': 0.16; ':-)': 0.16; 'sender:addr:gmail.com': 0.17; 'wrote:': 0.18; 'variable': 0.18; 'mechanism': 0.19; "python's": 0.19; 'value.': 0.19; 'later': 0.20; 'meant': 0.20; 'seems': 0.21; '>>>': 0.22; 'comfortable': 0.22; 'saying': 0.22; 'cc:addr:python.org': 0.22; 'header:User- Agent:1': 0.23; 'refers': 0.24; 'mon,': 0.24; 'cc:2**0': 0.24; 'cc:no real name:2**0': 0.24; 'second': 0.26; 'values': 0.27; 'header:In-Reply-To:1': 0.27; 'generally': 0.29; 'points': 0.29; "doesn't": 0.30; 'statement': 0.30; "i'm": 0.30; 'program,': 0.31; '>>>>': 0.31; 'changed.': 0.31; "d'aprano": 0.31; 'religious': 0.31; 'sep': 0.31; 'steven': 0.31; 'though.': 0.31; 'values.': 0.31; 'writes:': 0.31; 'blog:': 0.33; '"the': 0.34; 'could': 0.34; 'something': 0.35; 'case,': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'doing': 0.36; "i'll": 0.36; 'subject:?': 0.36; 'two': 0.37; 'list': 0.37; 'being': 0.38; 'sometimes': 0.38; 'ben': 0.38; 'issue': 0.38; 'fact': 0.38; 'pm,': 0.38; 'anything': 0.39; 'itself': 0.39; 'experts': 0.60; 'referred': 0.60; 'skip:* 10': 0.61; 'course': 0.61; 'first': 0.61; 'name': 0.63; 'refer': 0.63; 'more': 0.64; 'different': 0.65; 'skip:\xe2 10': 0.65; 'talking': 0.65; 'here': 0.66; 'between': 0.67; '8bit%:43': 0.74; 'introduce': 0.78; 'ambiguous': 0.84; 'batchelder': 0.84; 'ethan': 0.84; 'furman': 0.84; 'partially': 0.84; 'same,': 0.91; '2013': 0.98 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=Ec1uqtnMTShmqudfC6gBXd8IVzzUUfGW6ujsRfA3Dxc=; b=lpsrsdO0Cjol2lKIjkbr3hM1Cb4mWxigznuhI7qhnOyArhCUr9LmNt4TnNHp+2FGXo 0pcvSG0sKhSKepnW5RsgMQicN+ugL8Eg8z7sTxzxT5NNTLF54Cb3uKqw4OXARFJNbukd r5XBgHTmtlgNYTmLDvn5MyVeeZmEMGZT2IrEJw2Qc1u3pw6H/hPdLjhRnMO3q87NXTEu bW3XJZOJHmDDJEz3yXniWUse0FGoiKOaA2PPZaPIP++OuicZ/ipGJTvpRWSam/0Ob8+M aV3q7BPJ2pZ6Gv4IuzAky7D/6JLszl9FKGU34xcBZTApoPYAH98yQCZwa4u5nW6sKsL5 oAWA== X-Received: by 10.236.189.97 with SMTP id b61mr26544554yhn.19.1380590917602; Mon, 30 Sep 2013 18:28:37 -0700 (PDT) Sender: Ned Batchelder Date: Mon, 30 Sep 2013 21:28:36 -0400 From: Ned Batchelder User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:17.0) Gecko/20130801 Thunderbird/17.0.8 MIME-Version: 1.0 To: Steven D'Aprano Subject: Re: Python variables? References: <6e338858-b9e6-4745-9959-35d7c0c7724e@googlegroups.com> <02724244-c924-4cf0-9656-71ade6e435c2@googlegroups.com> <5249ECFE.2050402@nedbatchelder.com> <5249F4EE.60604@stoneleaf.us> <7wr4c6rl6a.fsf@benfinney.id.au> <524a1f5c$0$29974$c3e8da3$5496439d@news.astraweb.com> In-Reply-To: <524a1f5c$0$29974$c3e8da3$5496439d@news.astraweb.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Cc: python-list@python.org 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: 63 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1380591267 news.xs4all.nl 15934 [2001:888:2000:d::a6]:53814 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:55156 On 9/30/13 9:03 PM, Steven D'Aprano wrote: > On Mon, 30 Sep 2013 19:47:49 -0400, Ned Batchelder wrote: > >> On 9/30/13 6:37 PM, Ben Finney wrote: >>> Ethan Furman writes: >>> >>>> From [Ned Batchelder]'s blog: >>>>> Names are Python's variables: they refer to values, and >>>>> those values can change (vary) over the course of your program. >>>> This is partially incorrect. If the value referred to by the name is >>>> immutable, then it cannot change; perhaps you meant to say that which >>>> object the name points to can vary over time? >>> I agree. Names are not Python's variables. >>> >>> If anything in Python is a “variable” as generally understood, it is >>> not a name. It is a *binding*, from a reference (a name, or some other >>> reference like a list item) to a value. >>> >>> It is the binding which can change over the course of the program, so >>> that is the variable. >>> >>> >> True, but no one calls the binding the variable. Here is a program: >> >> x = 4 >> >> Every one of us is perfectly comfortable talking about the variable x. >> Don't get hung up on implementation pedantry. The name x here refers to >> 4. Later it could refer to "four". The value associated with the name >> x changed. x is a variable. > Your statement is ambiguous -- do you mean the *association* between > value (object) and name changed, or the value which is associated with > the name changed? Yes, my statement was ambiguous. The value of x at time t1 can be different than the value of x at time t2, and there are two different ways it can differ. None of that changes the fact that the value associated with the name varies over the course of a program, giving rise to "variables." I prefer to say that Python has variables, and they work by a mechanism of names referring to values. I don't find that beginners get it by being told that Python has no variables. It seems to be something that experts sometimes find helpful, though. --Ned. > > In the first case, "the value associated with the name x changed" is no > different from saying "the name binding changed", only longer and more > ambiguous. > > In the second case, if you mean that the association remains the same, > but the value itself changed, that's demonstrably untrue since 4 is > immutable. But you know that :-) > > I straddle the fence on this dispute... I'll often refer to Python > variables when, in my option, it doesn't confuse the issue or introduce > ambiguity, but I feel guilty doing so :-) And I always look for the > opportunity to introduce the concept of name binding into the discussion. > I'm just not religious about it. > >