"ammar azif" <[EMAIL PROTECTED]> wrote 

> Something in python disturbs me ,
> 
> when i write a for loop, 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. 

That's a very recent change to C/C++ (1999 apparently), 
you used to be able to do that. In fact I hadn't realised that 
you couldn't any more! It was only when I wrote a test 
program I discovered you were right...

> Is it different in python?

Yes. Once you create a name within a scope it stays 
there and loops or code blocks are not a separate scope 
in Python 

-- 
Alan Gauld
Author of the Learn to Program web site
http://www.freenetpages.co.uk/hp/alan.gauld



_______________________________________________
Tutor maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/tutor

Reply via email to