Help understanding the decisions *behind* python?

Emmanuel Surleau emmanuel.surleau at gmail.com
Fri Jul 31 16:26:58 EDT 2009


On Friday 31 July 2009 21:55:11 Terry Reedy wrote:
> Emmanuel Surleau wrote:
> >> Beyond the mutable/hashable distinction, there is an important
> >> philosophical distinction articulated by Guido.  He deems tuples to
> >> be useful for struct like groupings of non-homogenous fields and
> >> lists to be useful for sequences of homogenous data suitable for
> >> looping.
>
> I think the use of the with 'homegeneous' in this context is wrong
> because 1) it is ambiguous or even sometimes not the case, and 2) it
> misleads. Everything is an object, so all collections are in that sense
> homogeneous. If the meaning is restricted to type(ob), than a list
> 'mixing' ints and floats would be non-homogeneous and not 'legitimate',
> but Guido does not really mean that.
>
> The word tuple comes from relational databases as a generalization of
> single, double, triple, quadruple, quintuple, sextuple, sestuple,
> octuple, etc. A tuple is a data record with a fixed number of fields
> with individual meaning. There is nothing about homogeneity of data type
> in that definition. A triple of floats is legitimately a tuple when each
> is a coordinate (the individual meanings). In other contexts, the same
> triple might properly be a list (such as of heights of people
> arbitrarily ordered).

My understanding is that, in this context, it's not so much data types which 
are heterogeneous, but the semantic meaning of the data. For instance, a tuple 
containing (first_name, last_name, address) would be a "legitimate" tuple, but 
not a tuple containing (address, address, address), which, if we follow 
Guido's philosophy, ought to be represented as a list.

Whether including the distinction in the language offers any practical benefit 
is questionable.

[snip]

> > This would tend to show that Guido's notion here was not particularly
> >  intuitive.
>
> The problem is that it *is* intuitive, on his part, and usually not well
> explained rationally.

Excellent point.

Cheers,

Emm



More information about the Python-list mailing list