Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!feeder.news-service.com!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.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'subject:Python': 0.04; 'terry': 0.07; 'url:bugs': 0.07; 'python': 0.07; '(also': 0.09; 'builtin': 0.09; 'initialized': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:80.91.229.12': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'received:lo.gmane.org': 0.09; 'str': 0.09; 'pm,': 0.11; '>>>': 0.12; ';-)': 0.14; 'wrote:': 0.14; 'binding"': 0.16; 'cpython,': 0.16; 'overloaded': 0.16; 'reedy': 0.16; '"python': 0.16; 'traceback': 0.16; '(most': 0.16; 'allocated': 0.19; 'source.': 0.19; 'seems': 0.21; 'jan': 0.22; 'not.': 0.22; 'saying': 0.22; 'header:In-Reply-To:1': 0.22; 'gregory': 0.23; 'last):': 0.23; 'objects,': 0.23; 'objects': 0.24; 'appears': 0.24; 'stored': 0.25; 'subject:data': 0.26; 'fixed': 0.27; 'error': 0.29; 'subject:?': 0.29; 'variables': 0.29; 'model': 0.31; 'ewing': 0.31; 'objects.': 0.31; 'typeerror:': 0.31; "skip:' 10": 0.32; 'to:addr:python-list': 0.32; 'another': 0.32; 'uses': 0.34; 'using': 0.34; 'header:X-Complaints-To:1': 0.34; 'certain': 0.34; 'summary': 0.35; 'file': 0.35; 'header:User-Agent:1': 0.35; '"",': 0.35; 'subject:What': 0.35; 'subject:use': 0.35; 'surely': 0.35; 'rather': 0.36; 'else': 0.37; 'data': 0.37; 'some': 0.37; 'refer': 0.37; 'url:python': 0.37; 'steven': 0.38; 'less': 0.38; 'url:org': 0.38; 'received:org': 0.38; 'to:addr:python.org': 0.39; 'could': 0.39; 'header:Mime-Version:1': 0.39; 'containing': 0.40; 'would': 0.40; 'header:Received:5': 0.40; 'messages': 0.40; 'might': 0.40; 'evidence': 0.60; 'human': 0.64; 'believe': 0.66; 'subject:other': 0.84 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Terry Reedy Subject: Re: What other languages use the same data model as Python? Date: Sun, 01 May 2011 21:42:45 -0400 References: <4dbd1dbf$0$29991$c3e8da3$5496439d@news.astraweb.com> <9265d8FtkqU1@mid.individual.net> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: rain.gmane.org User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.17) Gecko/20110414 Lightning/1.0b2 Thunderbird/3.1.10 In-Reply-To: <9265d8FtkqU1@mid.individual.net> 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: 58 NNTP-Posting-Host: 82.94.164.166 X-Trace: 1304300578 news.xs4all.nl 81484 [::ffff:82.94.164.166]:57522 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:4430 On 5/1/2011 6:33 PM, Gregory Ewing wrote: > Steven D'Aprano wrote: > >> Python uses a data model of "name binding" and "call by object" (also >> known as "call by sharing"). > > It can be summed up in a less jargony way by saying that all > data is stored in heap-allocated objects, This is incomprehensible jargon to some; is only (partly) true of (typical) machine-implementations; and seems not to be true of all objects. I believe that for CPython, builtin objects, including the fixed arrray of ints from -5 to 256, are allocated in another data segment (more CS jargon, which is irrelavant to human interpreters). Evidence 1: >>> id(int) 505285072 >>> id(str) 505233232 >>> id(1) 505493792 >>> id(-5) 505493696 This appears to be initialized data segment. (Someone else could take a white box approach and look at the source. ;-) >>> id(333333) 16512288 >>> id('a') 11227616 This is heap. Evidence 2: Some error messages use 'heap type' to mean 'Python-coded class' >>> 1 .__class__ = str Traceback (most recent call last): File "", line 1, in 1 .__class__ = str TypeError: __class__ assignment: only for heap types http://bugs.python.org/issue4600 > and variables refer to objects rather than containing them directly. > Everything else follows from that. Would you say 'names refer to objects rather than containing them directly'? Surely not. Using 'name' rather than the hugely overloaded tern 'variable' automatically avoids certain misunderstandings. A good summary might be "Python manipulates objects that are accessed through literals, names, and expressions." -- Terry Jan Reedy