Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #57200

Re: IDLE being too clever checking nonlocal declarations?

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 <python-python-list@m.gmane.org>
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 <tjreedy@udel.edu>
Subject Re: IDLE being too clever checking nonlocal declarations?
Date Mon, 21 Oct 2013 15:51:56 -0400
References <CAPTjJmpEaQxN10eSU2YzZZ-4wMoT3K=iFBYQqgBx_RZ3AWyfTw@mail.gmail.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-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 <CAPTjJmpEaQxN10eSU2YzZZ-4wMoT3K=iFBYQqgBx_RZ3AWyfTw@mail.gmail.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 <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.1316.1382385139.18130.python-list@python.org> (permalink)
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

Show key headers only | View raw


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

Back to comp.lang.python | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Re: IDLE being too clever checking nonlocal declarations? Terry Reedy <tjreedy@udel.edu> - 2013-10-21 15:51 -0400
  Re: IDLE being too clever checking nonlocal declarations? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-10-21 23:52 +0000
    Re: IDLE being too clever checking nonlocal declarations? Terry Reedy <tjreedy@udel.edu> - 2013-10-21 23:26 -0400
      Re: IDLE being too clever checking nonlocal declarations? Steven D'Aprano <steve@pearwood.info> - 2013-10-22 05:57 +0000
        Re: IDLE being too clever checking nonlocal declarations? Chris Angelico <rosuav@gmail.com> - 2013-10-22 17:24 +1100
        Newline in bash, was Re: IDLE being too clever checking nonlocal declarations? Peter Otten <__peter__@web.de> - 2013-10-22 09:20 +0200

csiph-web