Lists and Tuples

Arthur ajsiegel at optonline.com
Sun Dec 7 08:46:21 EST 2003


On Fri, 5 Dec 2003 11:10:34 -0600, Skip Montanaro <skip at pobox.com>
wrote:


>Generally, choose between tuples and lists based upon your data.  In
>situations where you have a small, fixed collection of objects of possibly
>differing types, use a tuple.  In situations where have a collection of
>objects of uniform type which might grow or shrink, use a list.  For
>example, an address might best be represented as a tuple:
>
>    itcs = ("2020 Ridge Avenue", "Evanston", "IL", "60201")
>    caffe_lena = ("47 Phila Street", "Saratoga Springs", "NY", "12866")
>
>Though all elements are actually strings, they are conceptually different
>types.  It probably makes no sense to define itcs as

Some of my confusion derived from these semantic issues.  We are
strongly typed and when the list/tuple distinction starts to be talked
with the words  "types"," homogenous" , "heterogenous" in close
proximity - we, on the receiving end, will .... 

I think the potential misdriection is obvious from your explanation
above.

"Type" is not normally an ambiguous word.  It seems to me that an
explanation would stress, upfront, that in fact
homogenous.hetereogenous in this context is at an abstract level, and
unrelated to type,as such and as your example illustrates. 

Or else, why does the word "type" need to occur at all, other than
perhaps to explain, explicitily, it is not of relevance

Rather than in a way that implies that it is.

This is a question really. Though not properly phrased as one. Because
I fear I am still missing something.


Art






More information about the Python-list mailing list