terminological obscurity

Michael Chermside mcherm at mcherm.com
Fri May 21 12:47:21 EDT 2004


Elaine Jackson writes:
> All tuple methods are also list methods, and most list methods are also tuple
> methods; among those that are NOT also tuple methods, there are exactly two
> ('count' and 'index') that do not involve mutation. Is there any special
reason
> why they AREN'T also tuple methods?

Yes. Both make sense only if you consider a tuple as a homogeneous
sequence of items, and that's not what Guido intended it to be
used for.

> A question about terminology ('namespace'):
>
> >>> prince=tuple()
> >>> king=[prince]
> >>> del prince
>
> At this point, does the object formerly known as prince belong to the
> namespace implemented by globals()? More generally, is there a
> terminological way to distinguish between (1) a function from a set
> of names into a set of objects, and (2) the aforementioned set of
> objects?

After executing your code, there exist two objects, one is a tuple
and the other is a list. The global namespace contains one binding:
the name "king" is bound to the aforementioned list. The tuple is
not referred to directly by any name in the global namespace but it
will not be garbage collected yet because it is referenced by the
list and cannot be freed until the list itself is freed.

Whether this answers your questions I'm not sure... the questions
didn't make sense to me.

> Is there a handy noun that refers to sameness of identity in the same
> way that 'equality' refers to sameness of value? ('Identicalness' is
> pretty clumsy, and 'identity' is confusing, since it already has a
> meaning that is closely related but needs to be kept distinct.)

I've usually heard "identity" used. I don't know of any other synonynms
to use here.

> Suppose X is a container that contains n items (incidentally, is 'items'
> the right term?) and i in an integer with 0<=i<=n. Does " X[i] " count
> as a 'name'?

"items" is a perfectly good term for the things in a list. In common
usage, "X[i]" is not a name. It is, however, an "L-value" -- a slightly
related term which (unlike "name") has a fairly precise definition.

-- Michael Chermside







More information about the Python-list mailing list