block scope?

Terry Reedy tjreedy at udel.edu
Fri Apr 6 19:39:51 CEST 2007


"Neal Becker" <ndbecker2 at gmail.com> wrote in message 
news:ev5r7p$pdf$1 at sea.gmane.org...
| One thing I sometimes miss, which is common in some other languages 
(c++),
| is idea of block scope.  It would be useful to have variables that did 
not
| outlive their block, primarily to avoid name clashes.  This also leads to
| more readable code.  I wonder if this has been discussed?

Yes, but Guido (and others) prefer to keep things simple.

There is also the question of how to indicate a limited scope.  In C++, you 
put the declaration in the scope.  But Python has no such declarations.

tjr






More information about the Python-list mailing list