Path: csiph.com!usenet.pasdenom.info!news.etla.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed3.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.005 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'python.': 0.02; 'static': 0.04; 'subject:Python': 0.06; 'assuming': 0.09; 'optimizing': 0.09; 'runtime': 0.09; 'subject:language': 0.09; 'cc:addr:python- list': 0.11; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'hmm.': 0.16; 'subject:programming': 0.16; 'wrote:': 0.18; 'code,': 0.22; 'cc:addr:python.org': 0.22; 'now?': 0.24; 'decide': 0.24; 'cc:2**0': 0.24; 'sort': 0.25; 'right.': 0.26; 'subject:/': 0.26; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; 'dec': 0.30; 'message-id:@mail.gmail.com': 0.30; "i'm": 0.30; "d'aprano": 0.31; 'steven': 0.31; 'fri,': 0.33; 'could': 0.34; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'should': 0.36; 'sure': 0.39; 'either': 0.39; 'how': 0.40; 'truly': 0.60; "you're": 0.61; 'first': 0.61; '20,': 0.68; 'optimized': 0.68; 'safe': 0.72; 'analysis': 0.75; 'to:none': 0.92; '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:date:message-id:subject:from:cc :content-type; bh=y8yDI6i0u1SpMj6qYKmLxHjhr3PPv8oUWWQ8+Ni3Y/Q=; b=jcJ6tyD3Z91dZkCbgGLwG//I/qHGKPRP0sI2SN9MNdwqf7uia6auD+uXcc/EnV2EnU wKjOsq7Y7cZy+JNRvL7X1we8kz+H5aoKtuQQxwpkzc/KlXeKt+9sNgwZ2CX1sh+J4fyV tBFHYAa26nJo324TQy4Vw0XkxHsftXDymUn0H1ar3s9lnjmUvMFR3RSyGAFwBqrVm6Pp TDZhWeOHrp6+9clsuGDDkwwWh0misquLR2hGT1zw/a/3e1A2LZSv8chc0WRIoTyn0b4c HjlGSOTj6gL5IDcvYhSgt+6DND7UMTuUhjZcAE3PSJURZ3PdrqJ60aHLDFZD7aFNRBbp tDFw== MIME-Version: 1.0 X-Received: by 10.66.102.39 with SMTP id fl7mr2916802pab.43.1387473501515; Thu, 19 Dec 2013 09:18:21 -0800 (PST) In-Reply-To: <52b3277c$0$6512$c3e8da3$5496439d@news.astraweb.com> References: <20131212213602.806ef8fd2626ca6f34bc83d6@gmx.net> <20131216213225.2006b30246e3a08ee241a191@gmx.net> <20131217165144.39bf9ba1cd4e4f27a96893ca@gmx.net> <52b0fb4f$0$29973$c3e8da3$5496439d@news.astraweb.com> <52b15a69$0$29973$c3e8da3$5496439d@news.astraweb.com> <52b3277c$0$6512$c3e8da3$5496439d@news.astraweb.com> Date: Fri, 20 Dec 2013 04:18:21 +1100 Subject: Re: Experiences/guidance on teaching Python as a first programming language 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: 15 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1387473510 news.xs4all.nl 2912 [2001:888:2000:d::a6]:53940 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:62410 On Fri, Dec 20, 2013 at 4:06 AM, Steven D'Aprano wrote: > Should some implementation decide to compile that away as dead > code, it would be perfectly allowed to. (Well, assuming that it > determined first that locals() actually was the built-in and not some > substitute, either by static analysis or runtime testing.) Hmm. I'm not sure how safe it is to optimize that sort of thing away in Python. Is there any way to be truly sure that locals is still the built-in, and if there isn't, is there any advantage to optimizing it out with some sort of check to see if it should be de-optimized now? But yes, in theory you're right. Mutating locals() could be optimized out. ChrisA