[Python-Dev] elimination of scope bleeding ofiteration variables

Delaney, Timothy (Tim) tdelaney at avaya.com
Tue May 2 00:52:01 CEST 2006


Greg Ewing wrote:

>    for x in stuff:
>      for x in otherstuff:
>        dosomethingelse(x)
> 
> would be a SyntaxError because the inner loop
> is trying to use x while it's still in use by the
> outer loop.

So would this also be a SyntaxError?

    for x in stuff:
        x = somethingelse

Tim Delaney


More information about the Python-Dev mailing list