[Python-Dev] Namespaces

Aahz aahz@pythoncraft.com
Sat, 6 Apr 2002 09:22:59 -0500

On Sat, Apr 06, 2002, Barry A. Warsaw wrote:
> >>>>> "A" == Aahz  <aahz@pythoncraft.com> writes:
>     A> * primary names (gotten from the lang ref), which are names in
>     A> the local/global/builtin namespace
>     A> * object names (and a module is an object ;-) AKA attributes
> I'd just call these "attributes" <wink>.  Okay, maybe "attribute names".

I'd agree with that if I agreed with what you later say about bindings.

>     A> * computed bindings (getitem/setitem)
> I'd call these "computed attributes".  I don't like "computed
> bindings" because that sounds like you're saying that you're computing
> both the target of the binding and the object that is being bound (or
> one or the other?).

Ah!  "Target" is a good word.

>     A> What do we call all three of these collectively?  I'd say that
>     A> I agree with MvL that computed bindings are not in fact names,
> "Computed attributes" aren't bindings, but that only matters if you
> can tell the difference.  In a normal situation, if you see "obj.foo"
> it may not matter that "foo" only exists by virtue of a
> setattr/getattr/descriptor.  I'd still claim that "foo" is an
> attribute name because it's part of the public interface for obj,
> albeit perhaps a virtual attribute name.

Oh, yes, they are bindings.  Thinking about this a bit further, a
binding is anything that increases the refcount of an object.  If you
don't want to use the word "binding" to describe this, come up with some
other word that describes the same thing.

>     A> and as I said in my other post, using "binding" as the
>     A> collective noun looks ugly when we're also using it as a verb.
>     A> The key is to come up with some good way of saying
>     A>     When rebinding a <foo> ...
> Names get bound, so names get rebound.  At least, that's how I think
> about it.

Right.  And if I agree with MvL that computed bindings are names, then
this is fine.

Guido?  Are you paying any attention to this discussion?
Aahz (aahz@pythoncraft.com)           <*>         http://www.pythoncraft.com/

"There are times when effort is important and necessary, but this should
not be taken as any kind of moral imperative."  --jdecker