On 4/24/07, ammar azif <[EMAIL PROTECTED]> wrote: > i am able to access the variable declared in that loop after the loop > finishes which i am not able to do in languages like c/c++ or java. Is it > different in python?
I'm not sure what you mean with "different", but the loop-variable is not destroyed upon the exit of the for-loop: >>> z Traceback (most recent call last): File "<stdin>", line 1, in ? NameError: name 'z' is not defined >>> for z in (1,2,3): pass ... >>> print z 3 -- - Rikard - http://bos.hack.org/cv/ _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor