global, globals(), _global ?
Alex Martelli
aleaxit at yahoo.com
Wed Mar 15 11:04:35 EST 2006
robert <no-spam at no-spam-no-spam.com> wrote:
...
> ( And that later scheme is fairly wonderful - compare for example the
> namespace fuzz in C/C++, Pascal, Ruby, ... where you never know which
> module file addeds what to which namespace;
Pascal (per se) doesn't really have much by the way of namespaces
(alas). C++ (per se) does, with zap::zop=23 being rather unambiguous (C
compatibility and "using namespace zap" can muddy it up, but that's like
saying, e.g., that "from zap import *" muddies things up in Python:
true, but the obvious solution in both cases is "just don't do it";-).
Sure, any C++ or Ruby soure file can reopen a namespace or class,
respectifely -- but how's that different from Python's
"anothermodule.zop=23"? It's much of a muchness.
> In Ruby they even scribble from anywhere to _any_ class _and_ any
> namespace without the barrier of a dot or subclassing or anything -
> using somehow by random the same name already joins!? A threat for good
> modularization of code. Not far from free flat memory programming :-)
> Don't know how they keep bigger projects managable in this language.
Uh? I don't see what you mean -- in Ruby, an assignment can be clearly
situated regarding what namespace it affects. The only example of
"using somehow by random the same name" I can think of is within a
block, where (e.g.) 'a=2' sets a new block-local name _unless_ 'a' was
previously used within the lexically enclosing method, in which case it
resets said method's 'a', but while unpleasant that's a fairly localized
problem. Maybe you can give some examples?
Alex
More information about the Python-list
mailing list