tuple.index()
Nick Maclaren
nmm1 at cus.cam.ac.uk
Thu Dec 14 06:56:59 EST 2006
In article <mailman.1588.1166096890.32031.python-list at python.org>,
Fredrik Lundh <fredrik at pythonware.com> writes:
|>
|> > Why doesn't the tuple type have an index method? It seems such a
|> > bizarre restriction that there must be some reason for it.
|>
|> hah! not being able to remove or add things to tuples is an even
|> bizarrer restriction!
Eh? Why?
My understanding of the difference between a tuple and a list is
PRECISELY that the former is immutable and the latter mutable.
But an index method makes precisely as much sense on an immutable
sequence as it does on a mutable one.
Regards,
Nick Maclaren.
More information about the Python-list
mailing list