Can't figure out where SyntaxError: can not delete variable 'x' referenced in nested scope us coming from in python =2.6

2008-12-09 Thread Albert Hopkins
Say I have module foo.py: def a(x): def b(): x del x If I run foo.py under Python 2.4.4 I get: File foo.py, line 4 del x SyntaxError: can not delete variable 'x' referenced in nested scope Under Python

Re: Can't figure out where SyntaxError: can not delete variable 'x' referenced in nested scope us coming from in python =2.6

2008-12-09 Thread rdmurray
On Tue, 9 Dec 2008 at 13:11, Albert Hopkins wrote: Say I have module foo.py: def a(x): def b(): x del x [...] The difference is under Python 2.4 I get a traceback with the lineno and offending line, but I do not get a traceback in Pythons 2.6 and 3.0.

Re: Can't figure out where SyntaxError: can not delete variable 'x' referenced in nested scope us coming from in python =2.6

2008-12-09 Thread Steven D'Aprano
On Tue, 09 Dec 2008 13:11:40 -0500, Albert Hopkins wrote: The difference is under Python 2.4 I get a traceback with the lineno and offending line, but I do not get a traceback in Pythons 2.6 and 3.0. If tracebacks are broken, surely that would be a pretty huge bug. It seems to be broken in

Re: Can't figure out where SyntaxError: can not delete variable 'x' referenced in nested scope us coming from in python =2.6

2008-12-09 Thread Albert Hopkins
On Tue, 2008-12-09 at 22:57 +, Steven D'Aprano wrote: [...] So is there a way to find the offending code w/o having to go through every line of code in 'foo' by hand? Just search for del x in your code. Your editor does have a search function, surely? Well, you'd think I'd be

Re: Can't figure out where SyntaxError: can not delete variable 'x' referenced in nested scope us coming from in python =2.6

2008-12-09 Thread Steven D'Aprano
On Tue, 09 Dec 2008 22:57:36 -0500, Albert Hopkins wrote: On Tue, 2008-12-09 at 22:57 +, Steven D'Aprano wrote: [...] So is there a way to find the offending code w/o having to go through every line of code in 'foo' by hand? Just search for del x in your code. Your editor does have a