[Tutor] scope/namespaces
Alan Gauld
alan.gauld at btinternet.com
Tue Apr 24 19:27:37 CEST 2007
> Ezra Taylor wrote:
>> How can we limit this functionality so that
>> python
>> behaves similar to other know languages.
There are many other languages that work like Python.
Including the original versions of C and C++...
And other languages that don't have explicit loop constructs
at all! Others only have while loops...
> Maybe I should be asking what
> are the benifits of allow variables not being bound to a block of
> code.
For one thing you can find out how far a loop got to if it was
exited via a break.
for n in range(25):
if doit(item[n]) == False: break
print 'The loop stopped at item', n
There are lots of things that languages do differently, otherwise
there would be no point in having different languages! Embrace
the differences as an opportunity to see things differently. ;-)
--
Alan Gauld
Author of the Learn to Program web site
http://www.freenetpages.co.uk/hp/alan.gauld
More information about the Tutor
mailing list