tuple.index()
greg
greg at cosc.canterbury.ac.nz
Wed Dec 20 06:09:17 EST 2006
Nick Maclaren 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.
Then what do you think is suggested by the fact
that lists have an index() method but tuples don't?
That's how this whole discussion got started --
someone wanted an explanation of why that is so.
The explanation is that tuples and lists were
designed for different use cases.
You don't *have* to use them that way, but if
you use them differently, you're on your own
and can't complain if they don't have all the
features you want.
--
Greg
More information about the Python-list
mailing list