tuple.index()

Simon Brunning simon at brunningonline.net
Tue Dec 19 05:28:24 EST 2006


On 19 Dec 2006 10:01:47 GMT, Nick Maclaren <nmm1 at cus.cam.ac.uk> wrote:
>
>     It does explain why you think of lists as homogeneous, but the
> analogy doesn't hold water on closer inspection.  There doesn't seem
> to be ANYTHING in the specification or implementation that assumes
> lists are homogeneous.

As has been said a number of times in this thread, "lists are for
homogeneous data" isn't a technical restriction, it's purely
conceptual. It's what lists were designed for, and their API reflects
this. Any by "objects of the same type", we are not talking about
"type" in any technical sense.

But you go ahead and put whatever you like in them if you have trouble
with the idea.

Similarly, the tuple API was designed for heterogeneous items where
the items' position in the list has semantic meaning. Use them as you
will, but don't complain if the API doesn't support what you want to
do.

I've had enough of this thread. You can lead a horse to water...

-- 
Cheers,
Simon B
simon at brunningonline.net



More information about the Python-list mailing list