> Don't know if you saw the discussion in the PEP or not. Sorry, I had no time. I have read it now, but it doesn't change my point of view. > I made two > arguments for being able to assign to variables bound in enclosing > scopes. > > 1. Every other language that supports nested lexical scoping allows > this. To the extent that programmers have seen these other > languages, they will expect it to work. But we have a unique way of declaring variables, which makes the issues different. Your PEP wonders why I am against allowing assignment to intermediate levels. Here's my answer: all the syntaxes that have been proposed to spell this have problems. So let's not provide a way to spell it. I predict that it won't be a problem. If it becomes a problem, we can add a way to spell it later. I expect that the mechanism that will be used to find variables at intermediate levels can also be used to set them, so it won't affect that part of the implementation much. > 2. It is possible to work around this limitation by using containers. > If you want to have an integer that can be updated by nested > functions, you wrap the interger in a list and make all assignments > and references refer to list[0]. It would be unfortunate if > programmers used this style, because it is obscure. I'd rather see > the language provide a way to support this style of programming > directly. I don't expect that programmers will use this style. When they have this need, they will more likely use a class. --Guido van Rossum (home page: http://www.python.org/~guido/)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4