Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed2.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; 'subject:IDLE': 0.04; 'syntax': 0.04; 'see.': 0.07; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'python': 0.11; 'def': 0.12; 'jan': 0.12; "'q'": 0.16; 'a():': 0.16; 'b():': 0.16; 'command-line': 0.16; 'raised.': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'reedy': 0.16; 'subject:too': 0.16; 'syntaxerror:': 0.16; 'throw': 0.16; 'wrote:': 0.18; 'typing': 0.19; 'command': 0.22; 'header:User- Agent:1': 0.23; 'fine': 0.24; 'tracker': 0.26; 'header:X -Complaints-To:1': 0.27; 'header:In-Reply-To:1': 0.27; 'chris': 0.29; 'am,': 0.29; "doesn't": 0.30; 'lines': 0.31; '>>>>': 0.31; 'subject:?': 0.36; 'should': 0.36; 'checks': 0.38; 'to:addr :python-list': 0.38; 'issue': 0.38; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'even': 0.60; 'received:173': 0.61; 'name': 0.63; 'details': 0.65; 'line,': 0.68; 'received:fios.verizon.net': 0.84; 'subject:being': 0.84 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Terry Reedy Subject: Re: IDLE being too clever checking nonlocal declarations? Date: Mon, 21 Oct 2013 15:51:56 -0400 References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: pool-173-59-117-133.phlapa.fios.verizon.net User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.0.1 In-Reply-To: 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: 26 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1382385139 news.xs4all.nl 15977 [2001:888:2000:d::a6]:43947 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:57200 On 10/21/2013 11:06 AM, Chris Angelico wrote: > Try typing this into IDLE: > >>>> def a(): > def b(): > nonlocal q > SyntaxError: no binding for nonlocal 'q' found If you submit those three lines to Python from the command line, that is what you see. > In interactive command-line Python, this doesn't throw an error, > it works fine if the name is used later: > >>>> def a(): > def b(): > nonlocal q > q+=1 I verified that interactive Python also syntax checks each line as entered, even for compound statements. Details should be left to the tracker issue you raised. -- Terry Jan Reedy