> Andreas Tawn wrote:
> > Terry Reedy wrote:
> >> Wrong.
> > Thank you.
> > 
> >> For loop variables continue after the loop exits.  This is 
> >> intentional.
> > I never knew that and I can't find reference to it in the docs. 
> 
> Interesting starting point. It never occurred to me
> that they might not. (So I didn't look for anything
> in the docs when they did :) ).
> 
> TJG

I don't have experience of too many other languages, but in C++ (and I
guess C)...

for (int i=0; i<10; ++i)
{
    doStuff(i);
}

doStuff(i); // Error

int i;

for (i=0; i<10;++i)
{
    doStuff(i);
}

doStuff(i); // No error

That's the behaviour I was expecting.

Is the Python behaviour just a happy side effect of the target list
assignment or specific design decision?

Cheers,

Drea
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to