Tuple index
Steven Bethard
steven.bethard at gmail.com
Mon Feb 21 16:37:22 EST 2005
Michael Hartl wrote:
> I actually find it strange that tuples don't have an index function,
> since finding the index doesn't involve any mutation. Anyone know why
> Python doesn't allow a statement like t.index('foo')?
Tuples aren't really intended for this kind of use. See:
http://www.python.org/doc/faq/general.html#why-are-there-separate-tuple-and-list-data-types
Tuples are supposed to be operated on as a group. It's even been
suggested occasionally on python-dev that in Python 3.0, tuples
shouldn't support iteration at all...
STeVe
More information about the Python-list
mailing list