block scope?

Steve Holden steve at holdenweb.com
Fri Apr 6 12:27:21 EDT 2007


Neal Becker wrote:
> 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?
> 
Nested scopes were put into the language for function definitions, at 
least. Back in around 2.0, I believe, though that's lost in the mists of 
time for me as it's not a feature I use.

I suspect, in fact, that those nested scopes have caused more trouble 
that they're worth, and continue to do so. Be that as it may, I don't 
think there's ever been any attempt to introduce scoping blocks into the 
language.

Any ideas how you'd like it done?

regards
  Steve
-- 
Steve Holden       +44 150 684 7255  +1 800 494 3119
Holden Web LLC/Ltd          http://www.holdenweb.com
Skype: holdenweb     http://del.icio.us/steve.holden
Recent Ramblings       http://holdenweb.blogspot.com




More information about the Python-list mailing list