"Alan Isaac" <[EMAIL PROTECTED]> wrote: > I doubt that *anyone* who programs in Python > has not encountered the situation where they change > a tuple to a list *solely* for the purpose of getting > access to the index method. This suggests a missing > method, does it not? Who has not done this? > Name yourself!
My name is Duncan and I claim my £5. I've checked through quite a lot of code and I can't find any situation where I've converted a tuple to a list before calling the index method (I did find one case, but it wasn't my code). My suspicicion is that any case where you find yourself calling index on a tuple indicates a code smell. Antoon came up with a use case which appeared plausible at first glance, but at least to me felt fundamentally wrong. (Without Carsten's useful post pointing out that he should have used array rather than struct I wouldn't instantly have know exactly why it was wrong.) My thoughts at the moment are that Python *should* have an index method on tuple: I wrote earlier that the benefit should outweight the costs, but I think by now the cost of implementing and maintaining it is probably outweighed by the pain of reading this thread. -- http://mail.python.org/mailman/listinfo/python-list