Ka-Ping Yee <[EMAIL PROTECTED]> wrote:
[snip lexical scoping option]
> Now i think this is a little bit weird, because the statement
> "var b = 4" in an outer scope changes the meaning of "b" in an
> inner scope.  But it does have the virtue of retaining behaviour
> compatible with today's Python, while offering a way to get proper
> lexical scopes for those who want to use them.
> 
> Thoughts?  Other ideas?

Using a keyword in an outer scope to state that a variable could be used
in a nested scope is counter to the current method for accessing a
parent scope with 'global'.  Using 'var' as the equivalent of 'global',
only for nested scopes, would be a more reasonable approach.

However, I'm -1 on the feature now, for the same reasons I've been -1 on
the feature for the last 2 times it has come up.  In many of the cases
where lexically nested scopes have been used to solve problems in Python,
and programmers have run into a 'limitation' where not being able to
modify a value in a parent scope has hindered them, the problem could
have been better solved with another method that was more readable, more
extensible, etc.

What I asked before, and what I'd like to ask again, is if there are any
_nontrivial uses_ of lexically nested scopes which are made cumbersome
by our inability to write to parent scopes.  If there aren't, then I'm
going to again have to argue against new syntax, keywords, and their use.
If there are, then we'll see how compelling such uses are.

 - Josiah

_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to