terminological obscurity

John Roth newsgroups at jhrothjr.com
Fri May 21 16:46:17 EDT 2004


"Elaine Jackson" <elainejackson7355 at home.com> wrote in message
news:4Zsrc.528320$Pk3.64397 at pd7tw1no...
> "Michael Chermside" <mcherm at mcherm.com> wrote in message
> news:mailman.145.1085158045.6949.python-list at python.org...
> | 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.
>
> ####################################################
> This invites the question: What DID he intend it to be used for?
> Also, like the other respondent, I don't understand what homogeneity has
to do
> with it.
> ####################################################

This is one of the longstanding issues. Guido intended lists
for conceptually homogeneous cases: that is, part of a list
is conceptually similar to the entire list.

Tuples are intended for places where you want to simply
gather up a bunch of objects into one object for convenience
in passing them around. Assume, for example, that I've got
a tuple that includes a name, address, postal code, telephone
number, part number and order quantity. Half of that tuple
is not conceptually the same as the entire tuple. That's what
is meant by inhomogenaity.

There are a number of places where this gets sticky,
and other people regard other properties as more important.
It is, however, Guido's language. He's the Benevolant Dictator
for Life, so his intention is the official intention.

John Roth








More information about the Python-list mailing list