"Don't rebind built-in names*" - it confuses readers
Mark Janssen
dreamingforward at gmail.com
Wed Jun 12 20:04:48 EDT 2013
>> This has caused more trouble than it has solved.
>
> I take it you have never programmed in a programming language with a
> single, flat, global namespace? :-)
Hey, the purpose a programming language (i.e. a language which has a
consistent lexical specification), is to provide some modicum of
structure. Yes, that implies that you're implicitly following a
language designers tacit philosophy (their "ObjectArchitecture") for
relating data to computers, but that's fine. People always have the
option of going back to assembly and starting over.
> Apart from Erlang, got any other examples? Because it seems to me that in
> languages with nested scopes or namespaces, shadowing higher levels is
> exactly the right thing to do.
Really?
>>> int="five"
>>> [int(i) for i in ["1","2","3"]]
TypeError: str is not callable
Now how are you going to get the original int type back?
> Certainly it would be a PITA, and defeat
> the purpose of having nested scopes, if inner names had to be globally
> unique. Wouldn't it be absolutely horrible if adding a global variable
> "foo"[1] suddenly meant that all your functions that used "foo" as a
> local variable stopped working?
Not necessarily, but this is what I'm talking about in defining a
ObjectArchitecture (or in some circles a "type system").
--
MarkJ
Tacoma, Washington
More information about the Python-list
mailing list