[Tutor] scope/namespaces

Ezra Taylor ezra.taylor at gmail.com
Tue Apr 24 15:07:39 CEST 2007


Sorry about that kent.  I just realized I emailed you directly.

Ezra

On 4/24/07, Kent Johnson <kent37 at tds.net> wrote:
>
> ammar azif 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. Is
> > it different in python?
>
> Yes, it is different. In Python a block is not a scope. Names bound
> within the block, including the loop variable, are accessible outside
> the block.
>
> Kent
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
>



-- 
Ezra Taylor
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20070424/0b01891d/attachment.htm 


More information about the Tutor mailing list