jordan at krushen.com
Sat Oct 11 07:12:31 CEST 2003
On Fri, 10 Oct 2003 22:22:04 GMT, Alex Martelli <aleaxit at yahoo.com> wrote:
> The problem with global is that it's not clear enough. If there simply
> was NO way at all to have any assignment to a bare name, such
> as "a=2", EVER affect anything BUT a local, things would be much
> clearer; the need to import __current_module__ would emphasize what
> a serious, think-twice-about-it decision it is to choose to rebind
> module-global names. It would also emphasize that 'global' means
> 'of this module', not in any way of ALL modules -- a misconception
> that often affects newbies.
> Hmmm -- maybe THIS is worth proposing for 2.4 (with a
> pending deprecation warning for the global statement)...
I'm rather amused at the thought of a module importing itself. I find it
cleaner than global, and it also emphasizes that modules are singletons,
if you think about how a module *can* import itself.
I think that __current_module__ is perhaps a bit too lengthy (although I
appreciate the motivation behind this), but aside from that, I like it.
I'm also pleased with the ouroboros-like imagery it conjures..
More information about the Python-list