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


Groups > comp.lang.python > #57197 > unrolled thread

Re: IDLE being too clever checking nonlocal declarations?

Started byPeter Otten <__peter__@web.de>
First post2013-10-21 18:09 +0200
Last post2013-10-21 18:09 +0200
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: IDLE being too clever checking nonlocal declarations? Peter Otten <__peter__@web.de> - 2013-10-21 18:09 +0200

#57197 — Re: IDLE being too clever checking nonlocal declarations?

FromPeter Otten <__peter__@web.de>
Date2013-10-21 18:09 +0200
SubjectRe: IDLE being too clever checking nonlocal declarations?
Message-ID<mailman.1314.1382371766.18130.python-list@python.org>
Chris Angelico wrote:

> Try typing this into IDLE:
> 
>>>> def a():
>     def b():
>         nonlocal q
> SyntaxError: no binding for nonlocal 'q' found
> 
> 
> In interactive command-line Python, this doesn't throw an error, and
> it works fine if the name is used later:
> 
>>>> def a():
>     def b():
>         nonlocal q
>         q+=1
>     q=1
>     b()
>     return q
> 
>>>> a()
> 2
> 
> But typing this into IDLE interactive mode requires some fiddling
> around with the editor. Is it trying to be too clever? Am I doing
> something that makes no sense?

Yes, but you should still file a bug report ;)
 
> Tested with 3.3.0 on Windows XP.

Confirmed on Linux for 3.2.2, 3.3.0, and an outdated built of 3.4. It looks 
like all versions of Python 3 are affected.

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web