On Mon, 21 Oct 2013 23:26:28 -0400, Terry Reedy wrote:
On 10/21/2013 7:52 PM, Steven D'Aprano wrote:
On Mon, 21 Oct 2013 15:51:56 -0400, Terry Reedy wrote:
On 10/21/2013 11:06 AM, Chris Angelico wrote:
Try typing this into IDLE:
def a():
def b():
nonlocal q
SyntaxError:
On Tue, Oct 22, 2013 at 4:57 PM, Steven D'Aprano st...@pearwood.info wrote:
Yep, I got that, but what I'm saying is that it is too strict to raise
the exception at the point where it sees nonlocal q. The CPython
interpreter allows q to be defined inside function a but after function
b, e.g.
Steven D'Aprano wrote:
On Mon, 21 Oct 2013 23:26:28 -0400, Terry Reedy wrote:
On 10/21/2013 7:52 PM, Steven D'Aprano wrote:
On Mon, 21 Oct 2013 15:51:56 -0400, Terry Reedy wrote:
On 10/21/2013 11:06 AM, Chris Angelico wrote:
Try typing this into IDLE:
def a():
def b():
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
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():
On Tue, Oct 22, 2013 at 3:09 AM, Peter Otten __pete...@web.de wrote:
Chris Angelico wrote:
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
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,
On Mon, 21 Oct 2013 15:51:56 -0400, Terry Reedy wrote:
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
On 10/21/2013 7:52 PM, Steven D'Aprano wrote:
On Mon, 21 Oct 2013 15:51:56 -0400, Terry Reedy wrote:
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