Help understanding the decisions *behind* python?

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Sat Aug 1 05:22:35 CEST 2009


En Fri, 31 Jul 2009 17:26:58 -0300, Emmanuel Surleau  
<emmanuel.surleau at gmail.com> escribió:
> On Friday 31 July 2009 21:55:11 Terry Reedy wrote:

>> 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.

Note that years ago the distinction was much stronger: tuples had NO  
methods at all. All you could do with a tuple was: len(t), t[i], t1+t2,  
t*n, e in t, for e in t
Being so "crippled", thinking of tuples just as immutable lists probably  
wasn't so natural.

-- 
Gabriel Genellina




More information about the Python-list mailing list