Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #57197
| From | Peter Otten <__peter__@web.de> |
|---|---|
| Subject | Re: IDLE being too clever checking nonlocal declarations? |
| Date | 2013-10-21 18:09 +0200 |
| Organization | None |
| References | <CAPTjJmpEaQxN10eSU2YzZZ-4wMoT3K=iFBYQqgBx_RZ3AWyfTw@mail.gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.1314.1382371766.18130.python-list@python.org> (permalink) |
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.
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: IDLE being too clever checking nonlocal declarations? Peter Otten <__peter__@web.de> - 2013-10-21 18:09 +0200
csiph-web