Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed1a.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; 'python,': 0.02; 'cpython': 0.05; '64-bit': 0.07; 'attribute': 0.07; 'indices': 0.07; 'variables': 0.07; 'string': 0.09; '3.0,': 0.09; '32-bit': 0.09; 'attributes': 0.09; 'implements': 0.09; 'integers': 0.09; 'pointers': 0.09; 'references,': 0.09; 'type,': 0.09; 'typed': 0.09; 'cc:addr:python-list': 0.11; 'python': 0.11; 'stored': 0.12; "wouldn't": 0.14; '"small"': 0.16; "'input'": 0.16; '(note': 0.16; 'a),': 0.16; 'constructs': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'integers,': 0.16; 'jython,': 0.16; 'rather,': 0.16; 'recorded': 0.16; 'registers.': 0.16; 'slow,': 0.16; 'variables,': 0.16; 'sat,': 0.16; 'wrote:': 0.18; '(not': 0.18; 'library': 0.18; 'variable': 0.18; 'connects': 0.19; 'pieces': 0.19; "python's": 0.19; 'python?': 0.22; 'cc:addr:python.org': 0.22; "aren't": 0.24; 'certainly': 0.24; 'cc:2**0': 0.24; 'compiled': 0.26; 'references': 0.26; 'pass': 0.26; 'header:In-Reply-To:1': 0.27; 'function': 0.29; 'am,': 0.29; 'message-id:@mail.gmail.com': 0.30; 'easier': 0.31; 'that.': 0.31; 'piece': 0.31; 'handled': 0.32; 'another': 0.32; 'actual': 0.34; 'could': 0.34; "can't": 0.35; 'connection': 0.35; 'objects': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'done,': 0.36; 'object,': 0.36; 'being': 0.38; 'previous': 0.38; 'anything': 0.39; 'itself': 0.39; 'either': 0.39; 'card': 0.63; 'more': 0.64; 'compliant': 0.68; 'results': 0.69; 'to,': 0.72; 'other.': 0.75; 'paper': 0.75; '100%': 0.77; "it'd": 0.84; 'speak,': 0.84; 'whereby': 0.84; 'demand': 0.91; 'to:none': 0.92 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=g5LJGABdsNBJ3z4IAKIuz6tYsHASffWBf+555t4Hf+Q=; b=uRmmx1hkLN5bFX0vwPuF4Rye8yjxN/Kk/NiFBc6M4QmxjHBTvXbshUgo43b2sAxF2a QiHHBUTquROlTuY0V+KpPZrnfKLuBELGz/z34+Ef/lLH7ET6GoK5VQYFP7/sdyTNO3i9 SN5JBxGdGaLVWjen/WyVtyCkd+G+JoyD8Jjfuc4kND1ZT6Z/ezpxEszcMqYLMd066HFX 6KPkQAHFvsJ//EAEfZieWAUOZtADdGZztvr9rk16iI3FVdAnN/Vei0z6Cq6+f9N5pcP3 jaViSwIjrIXS/LvYXjiiMSEATccxp/NOl1qfWYi6jluIv6srwo5R4UMzWPC4HazzwA+M U4TQ== MIME-Version: 1.0 X-Received: by 10.221.34.7 with SMTP id sq7mr10949223vcb.5.1399687126140; Fri, 09 May 2014 18:58:46 -0700 (PDT) In-Reply-To: <87zjiqbmy5.fsf@elektro.pacujo.net> References: <235C4BFA-9770-481A-9FCF-21C3F036769C@gmail.com> <5368681D.8070602@islandtraining.com> <87ppjpwafk.fsf@elektro.pacujo.net> <536ad8f2$0$29965$c3e8da3$5496439d@news.astraweb.com> <87zjiqbmy5.fsf@elektro.pacujo.net> Date: Sat, 10 May 2014 11:58:46 +1000 Subject: Re: Values and objects From: Chris Angelico Cc: "python-list@python.org" Content-Type: text/plain; charset=UTF-8 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: 44 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1399687129 news.xs4all.nl 2874 [2001:888:2000:d::a6]:58999 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:71212 On Sat, May 10, 2014 at 8:34 AM, Marko Rauhamaa wrote: > Right, Python's variables aren't like variables in C. Rather, Python's > variables are like CPU registers. They cannot hold typed or structured > objects and you can't pass references to them. Are you thinking that a Python variable is neither more nor less than what CPython implements them as? Because I can design you a 100% compliant Python implementation in which: * Objects are represented with pieces of paper * Object types are represented with 150GSM paper so it's easier to find (note that an object type, being itself an object, must be represented with paper) * Named attributes and numeric indices (__[gs]etitem__) are recorded with ink on the paper * References, including from an object to its type, are pieces of string linking an attribute to another object * None is, in the interests of performance, represented by a piece of string that dangles * Functions get compiled down to a byte-code stored on eighty-column punched card * Integers and strings are always interned * The image processing library is stored inside an actual pillowcase * The 'print' function results in a human being speaking, and 'input' waits for another human to speak, and constructs a string with what was said As far as I know, this could be done, and it would be perfectly compliant with all of Python. It'd be horrendously slow, but Python's specs never demand performance. It wouldn't have C-like variables, it wouldn't have pointers (assigning "a = b" means looking up b, finding which object the string connects to, gluing another string to that same object, and severing any previous connection from a), and it certainly wouldn't have 32-bit or 64-bit integers, or anything like that. (Not that CPython has anything of the sort, as of 3.0, but it's perfectly conceivable for a compliant Python to have an optimization whereby "small" integers are handled more efficiently. Again, the Python specs don't say either way.) So what is a "variable" in this Python? Well... exactly what it is in any other Python, because this is just as much Python as CPython, Jython, PyPy, or any other. ChrisA