Mon, 1 Apr 2002 16:00:02 -0500
>>>>> "A" == aahz <firstname.lastname@example.org> writes:
A> You're only correct if you define namespaces as being the set of
A> nested first-level lookups. If you define "attribute" as "name
A> bound to an object namespace", then we're pretty much in
A> agreement. We certainly talk often enough of module namespaces;
A> I think it makes sense to expand that usage to all objects.
I think it's fairly common for people to talk about an object's
attributes as its namespace. The language reference does not call
this a namespace. In fact, the lang ref doesn't define namespace and
often uses other words to discuss naming: names, blocks, scopes,
Perhaps namespace is too fuzzy and we should introduce a precise term
to talk about the attribute "namespace" of an object.
The lang ref does say that the namespace of a class definition becomes
the attribute dictionary of the class. So "attribute dictionary"
seems to be preferred to "object namespace" <0.5 wink>.
A> It seems pretty clear to me that f.permissions does not live in
A> the local/global/builtins namespace, but it sure lives in f's
A> namespace. Because attributes are names like any other name and
A> can be bound to any Python object, I think it lends crucial
A> orthogonality to say that attributes live in object namespace.
Some people will be confused that a function f has two namespaces --
the namespace for its code object and the namespace for its
attributes. This reinforces my sense that we shouldn't use the term
namespace when we are trying to be precise. (Or that we need a
precise definition of namespace and a clear way to disambiguate the
two kinds of namespaces assocaited with a function.)
I'd also like to observe that the language reference doesn't say
anything about how attributes of objects are resolved. The tutorial
says a bit in the chapter on classes, but none of this made it to the
It would be nice to flesh out these issues in the reference manual.