[Python-3000] Draft PEP for outer scopes

Andrew McNamara andrewm at object-craft.com.au
Thu Nov 2 06:24:12 CET 2006


>Andrew McNamara wrote:
>> But it doesn't mean "top-level" - it already comes with the qualifier
>> "module".
>
>This is exactly what "global variable" means in C, Perl, JavaScript,
>Ruby, etc.
>
>The global scope is the widest scope in which you can declare a variable.

This is inaccurate at best. The reality is:

Python's "global" is module-global, yet there's a wider scope that is
searched after the module namespace: the __builtin__ module.

C has a similar concept module-global (module "static" variables), but
if I remember correctly Perl does not (globals are interpreter-global),
and neither does Javascript (globals are global to the document, with
each document essentially a separate interpreter instance).

To be honest, I'm +0 on using "global" in the way GvR proposes. My
point is that python's globals are already different from other common
languages, and people cope with that.

-- 
Andrew McNamara, Senior Developer, Object Craft
http://www.object-craft.com.au/


More information about the Python-3000 mailing list