Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed5.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.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'python,': 0.02; 'languages,': 0.04; 'true,': 0.04; 'subject:Python': 0.05; 'cpython': 0.05; 'important,': 0.07; 'variables.': 0.07; 'python': 0.09; 'bindings': 0.09; 'aug': 0.13; 'times,': 0.13; 'value.': 0.15; '(name': 0.16; 'decent': 0.16; 'driscoll': 0.16; 'finney': 0.16; 'from:addr:mrabarnett.plus.com': 0.16; 'from:addr:python': 0.16; 'from:name:mrab': 0.16; 'lisp,': 0.16; 'message- id:@mrabarnett.plus.com': 0.16; 'received:84.93': 0.16; 'received:84.93.230': 0.16; 'reference).': 0.16; 'subject:Objects': 0.16; 'term.': 0.16; 'wed,': 0.16; 'wrote:': 0.17; 'exists': 0.17; 'variables': 0.17; '(or': 0.18; 'variable': 0.20; 'java': 0.21; 'either.': 0.22; 'pascal': 0.22; 'references': 0.23; "haven't": 0.23; "i've": 0.23; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'values': 0.26; 'see,': 0.27; "doesn't": 0.28; 'this?': 0.28; "d'aprano": 0.29; 'received:192.168.1.3': 0.29; 'steven': 0.29; 'writes:': 0.29; 'objects': 0.29; 'basic': 0.30; 'function': 0.30; 'point': 0.31; 'received:84': 0.32; 'to:addr:python-list': 0.33; '(with': 0.33; 'ben': 0.35; 'exist': 0.35; 'really': 0.36; 'but': 0.36; 'programmers': 0.36; 'anything': 0.36; 'should': 0.36; 'too': 0.36; 'skip:p 20': 0.36; 'ok,': 0.37; 'quite': 0.37; 'far': 0.37; 'subject:: ': 0.38; 'mean': 0.38; 'instead': 0.39; 'to:addr:python.org': 0.39; 'received:192': 0.39; 'received:192.168': 0.40; 'think': 0.40; 'your': 0.60; 'most': 0.61; 'identify': 0.61; 'kind': 0.61; 'time,': 0.62; 'differences': 0.65; 'reasons,': 0.65; 'header:Reply-To:1': 0.68; 'fact,': 0.69; 'reply-to:no real name:2**0': 0.72; '\xe2\x80\x93': 0.75; 'discovered': 0.83; 'me).': 0.84; 'reply- to:addr:python.org': 0.84; 'hand,': 0.97 X-CM-Score: 0.00 X-CNFS-Analysis: v=2.0 cv=IekFqBWa c=1 sm=1 a=0nF1XD0wxitMEM03M9B4ZQ==:17 a=DKcI9XZsuF4A:10 a=ihvODaAuJD4A:10 a=OUOv7kDek9cA:10 a=IkcTkHD0fZMA:10 a=bbxUIyF837gA:10 a=EBOSESyhAAAA:8 a=8AHkEIZyAAAA:8 a=dRLqhde154Nll3S2gHsA:9 a=QEXdDO2ut3YA:10 a=0nF1XD0wxitMEM03M9B4ZQ==:117 X-AUTH: mrabarnett:2500 Date: Thu, 23 Aug 2012 12:28:55 +0100 From: MRAB User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:14.0) Gecko/20120713 Thunderbird/14.0 MIME-Version: 1.0 To: python-list@python.org Subject: Re: Objects in Python References: <18409992-1e28-4721-8e64-60c69668da4e@googlegroups.com> <87d32i1ntc.fsf@benfinney.id.au> <5035d3e4$0$1645$c3e8da3$76491128@news.astraweb.com> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list Reply-To: python-list@python.org 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: 39 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1345721330 news.xs4all.nl 6978 [2001:888:2000:d::a6]:41489 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:27726 On 23/08/2012 09:59, Jussi Piitulainen wrote: > Steven D'Aprano writes: >> On Wed, 22 Aug 2012 23:49:17 -0500, Evan Driscoll wrote: >> >> > On 8/22/2012 18:58, Ben Finney wrote: >> >> You haven't discovered anything about types; what you have >> >> discovered is that Python name bindings are not variables. >> >> >> >> In fact, Python doesn't have variables – not as C or Java >> >> programmers would understand the term. What it has instead are >> >> references to objects (with names as one kind of reference). >> > >> > OK, I've seen this said a few times, and I have to ask: what do >> > you mean by this? I consider myself pretty decent at Python and >> > other languages, and I really don't get it. >> >> I think the point that Ben would like to make is that while "name >> binding" is a specific kind of "variable", the word "variable" comes >> with too much baggage from the old-school C, Pascal etc. style of >> variables- are-named-memory-locations. Most of the time, the >> differences are unimportant, but when they are important, if your >> mental image is that Python "variables" (name bindings) are like C >> or Pascal "variables" (memory locations), you're going to get >> confused. > > I don't get it either. To me the python-has-no-variables campaigners > seem confused. As far as I can see, Python can be seen in terms of > variables bound to (locations containing) values perfectly well, in a > way that should be quite familiar to people who come from Java (or > Lisp, Scheme like me). > [snip] In Java a variable exists even when it has not been assigned a value. In Python, on the other hand, the basic model is that a 'variable' doesn't exist until it has been bound to an value (although, for efficiency reasons, that's not entirely true, because at compile time CPython will identify the local variables in a function and allocate a 'slot' for it).