Alex lists this flaw: > -- it's the wrong keyword, doesn't really _mean_ "global" Guido says: > I haven't heard anyone else in this thread agree with you on that > one. I certainly don't think it's of earth-shattering ugliness. Well, I agree. But I also agree with your point that it's certainly not earth-shattering... just a little confusing to newbies, who expect "global" to mean "global", not "module-wide". Not worth changing the language, but if you were to re-invent Python from the ground up, I'd consider it. Greg Ewing writes: > We'd be having two kinds of assignment, and there's no > prior art to suggest to suggest which should be = and > which :=. That's the "arbitrary" part. No one will ever confuse these, because no one will learn about := until long after = is well understood. The one spelled "=" will be "the normal one" and ":=" will be "the funny one". Just mentions: > (Alex noted in private mail that one disadvantage of this idea is that > it makes using globals perhaps TOO easy...) Indeed, that would be my concern. At least the word "global" has strong negative associations (mostly undeserved in this case since it really means "module-level" not "global" ;-). Skip writes: > It seems that use > of > x := 2 > and > x = 4 > should be disallowed in the same function so that the compiler can > flag such mistakes. I agree. When writing a function, we ALLOW name shadowing because we want the author of the function to be able to use local variables without having to know anything about the outer scope(s). But if the author of the function ALREADY KNOWS that there's an outer variable named "x" (MUST know it since she is modifying that outer variable), then there's no excuse for the poor choice of names... the local variable should be renamed to avoid the conflict. The "global" statement as it currently exists enforces this... if one assignment in a scope is "global", then ALL will be. I maintain that the use of := vs = should be the same... all or none! Despite Just's original preference for thinking of it as "find somplace and rebind", I would always wind up thinking of this as the "bind in some outer scope" operator. ----- Anyhow, that's as far as I got in reading the discussion so far. Whew! What a lot of traffic! -- Michael Chermside
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