Path: csiph.com!usenet.pasdenom.info!gegeweb.org!usenet-fr.net!nerim.net!novso.com!newsfeed.xs4all.nl!newsfeed3.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.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'subject:Python': 0.06; 'function,': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'runtime': 0.09; 'subject:language': 0.09; 'jan': 0.12; 'bind': 0.16; 'dict': 0.16; 'exception;': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'reedy': 0.16; 'returned,': 0.16; 'subject: \n ': 0.16; 'subject:programming': 0.16; 'wrote:': 0.18; 'unlike': 0.19; 'header:User-Agent:1': 0.23; 'subject:/': 0.26; 'header:X-Complaints-To:1': 0.27; 'header:In- Reply-To:1': 0.27; 'rest': 0.29; 'am,': 0.29; 'raise': 0.29; 'that.': 0.31; "d'aprano": 0.31; 'steven': 0.31; 'this.': 0.32; 'not.': 0.33; 'case,': 0.35; 'representing': 0.36; 'to:addr :python-list': 0.38; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'even': 0.60; 'received:173': 0.61; 'name': 0.63; 'between': 0.67; 'received:fios.verizon.net': 0.84; 'absolutely': 0.87 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Terry Reedy Subject: Re: Experiences/guidance on teaching Python as a first programming language Date: Wed, 18 Dec 2013 17:33:49 -0500 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> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: pool-173-75-254-207.phlapa.fios.verizon.net User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 In-Reply-To: <52b15a69$0$29973$c3e8da3$5496439d@news.astraweb.com> 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: 27 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1387406045 news.xs4all.nl 2831 [2001:888:2000:d::a6]:42069 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:62344 On 12/18/2013 3:18 AM, Steven D'Aprano wrote: > We don't know what locals()['spam'] = 42 will do inside a function, I am mystified that you would write this. Locals() will "Update and return a dictionary representing the current local symbol table." The only thing unspecified is the relation between the 'current local symbol table' and the *dict* that 'represents' it. Given that a dict is returned, the rest is unambiguous. > unlike the C case, we can reason about it: > > - it may bind 42 to the name "spam"; "somedict['spam'] = 42" will do exactly that. > - it may raise a runtime exception; Absolutely not. > - it may even be a no-op; Absolutely not. -- Terry Jan Reedy