Immutable sequence types lacking index() method
Jp Calderone
exarkun at divmod.com
Tue Aug 31 15:21:53 EDT 2004
Anne Wangnick wrote:
> Dear all,
>
> I don't get why the index() method is only defined for mutable sequence
> types. This is not what I expected. Shouldn't this be added in Python? Is
> there such a PEP already?
For all the *intended* uses of tuples, you should already know all
the indexes you need to know. They are implicit in the use of a tuple
as a data structure. If you do *not* know the index, you probably
should be using a list instead.
There have been numerous discussiong about what the *real*
differences between tuples and lists are, both here and on python-dev.
I recommend searching the archives if you are interested in the details.
Jp
More information about the Python-list
mailing list