
Paul Prescod wrote:
Dan Sugalski wrote:
Is this global in the "all variables are in one big pool and can be looked up by name", more or less the equivalent of externing all your C variables, or global in the "Any thread might be able to see it" sense? (I thought Python had lexically scoped variables, but I might be wrong here. I'm an internals guy--the actual language being run is just an implementation detail... :)
Python certainly has HIGHLY SCOPED variables. Hardly anything is global in that sense. Even a two-line script will not really have truly global, global variables. I wasn't so happy with Aahz's choice of wording there. :)
No, but it will have global, global objects. Any time one creates an object in Python, it has the potential to be bound to any name. Consider the module foo with attribute bar; foo.bar can be set at any time in any scope to any other object existing somewhere in Python's heap. And that change will be visible everwhere that the name foo.bar is visible. It gets even trickier with multiple threads created in a single module namespace combined with mutable objects and global names (as I illustrated in my response to Dan). -- --- Aahz (@pobox.com) Hugs and backrubs -- I break Rule 6 <*> http://www.rahul.net/aahz/ Androgynous poly kinky vanilla queer het Pythonista I don't really mind a person having the last whine, but I do mind someone else having the last self-righteous whine.