New submission from Chris Angelico:

IDLE tries to be helpful, but it errors on something that isn't yet an error. 
Pasting in this code works fine:

>>> def a():
        def b():
                nonlocal q
                q+=1
        q=1
        b()
        return q

>>> a()
2

But typing it, line by line, results in an error:

>>> def a():
        def b():
                nonlocal q
                
SyntaxError: no binding for nonlocal 'q' found

This doesn't occur with interactive command-line Python. A small issue, more of 
curiosity value than anything else - I don't have a non-trivial use-case where 
this causes problems.

----------
components: IDLE
messages: 200809
nosy: Rosuav
priority: normal
severity: normal
status: open
title: IDLE over-enthusiastically verifies 'nonlocal' usage
versions: Python 3.2, Python 3.3

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue19335>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to