On 4/6/07, Neal Becker <[EMAIL PROTECTED]> 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?
>

Block scope as a way to prevent name clashes is usually solved by
refactoring (in C++, too) - if you can't disambiguate locals in a
function it's usually a sign that your function does to much and needs
to be broken up.

Block scope as a way to control object lifetimes (automatic variables,
or RAII) is addressed (in 2.5) by context managers or (pre-2.5)
try/finally blocks.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to