questions about scope/threading

maney at pobox.com maney at pobox.com
Thu Nov 14 23:39:13 EST 2002


Aahz <aahz at pythoncraft.com> wrote:
> Thing is, while var3 is not a module global, any thread can access that
> name through Class1.var3 -- therefore, the object bound to Class1.var3
> is a completely global object, and you have to be careful what you do
> with Class1.var3 (or the object bound to it if the object is mutable).
> Tricky stuff.

I hadn't thought about Python's scoping that way before.  So anything not
"hidden" inside a function is present in the global tree of namespaces?
(or class definition.  hmmm, any others?)

<ponder>

Of course I knew that, and have used it to access modules, but somehow this
feels like a new point of view.  Interesting.



More information about the Python-list mailing list